feat: add syntax highlighting
Summary
This PR adds syntax highlighting feature
Demo:
Test plan
Ask AI for a message that can contain codeblock, for example: show me swift class that stores a counter state and has methods to increment and decrement
TODO
- [ ] Add option to disable syntax highlighting
I was wondering if we need an option to disable syntax highlighting - I've added it as TODO by Im not sure if it will be useful
@okwasniewski perhaps we could keep the opening and closing ``` and just colorize the content? That would make it stand out more, and also be easier for copy pasting to markdown (a minor thing).
Ugh, I'm sorry @mdjastrzebski I forgot about this PR.. I guess by looking at https://github.com/callstack/ai-cli/pull/34 this solution wouldn't be valid after Ink get's merged. Should I close the PR and later on reimplement it?
No worries @okwasniewski.
We've added ink to be able to implement streaming responses, and overall better UI in the near future.
The chalk code in your PR might not work directly either ink, but on the other hand it also seems to use chalk, so perhaps there is some easy way to adapt it.
@okwasniewski Ink implemenation is stable now. If you have some free capacity, please adjust the PR to the current codebase.
I'm sorry I won't find time to finish this soon and don't want to block implementing this feature. If anyone else wants to add this feature feel free to use my implementation as a base reference