Closed murtaza64 closed 2 months ago
Absolutely! This was the plan, the syntax based highlighting was really just to test out the idea. Would definitely welcome a PR.
As for delivery, we can just start with a separate repo that users install with https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#adding-parsers
I'm gonna take a crack at this over the next couple weeks between work! I have some experience with tree-sitter grammars, and I think it'll be relatively simple to get something good. I hope you don't mind if I also experiment with the format of the chat session itself a bit for readability and clarity
Sounds good! The format is not set in stone. The goal is something like a living record. It should be readable as a chat log without the plugin at all, but with the plugin the chat can be continued.
I ended up being pretty busy this week so not sure when I'll have time to work on this actively. If anyone else wants to take a stab at it in the meantime, go for it (and let me know so we don't duplicate work)
If we were to use tree-sitter for highlighting
mchat
buffers, we would be able to leverage injections to highlight code snippets correctly.tree-sitter-markdown
already implements this, and chatbots usually respond with valid markdown, so this wouldn't be too much of a lift. We would probably have to figure out how to deliver the tree-sitter parser to users, whether by putting it in the nvim-treesitter repo or some other way. I'm willing to look into this and create a PR--is this something you'd be interested in merging?