dustinblackman / oatmeal

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!
https://dustinblackman.com/posts/oatmeal/
MIT License
477 stars 23 forks source link

Python Syntax Highlighting #31

Closed ecthelionvi closed 8 months ago

ecthelionvi commented 8 months ago

I have observed an issue with Python Syntax Highlighting where it seems Oatmeal does not seems to be able to parse comments "#" correctly. When the first comment is included in the given code, the rest of the code is commented out. As far as I can tell this seems to only be a Python issue as Go code for example worked perfectly.

I have not configured the build.rs with a custom Python .sublime-syntax, but I am relying on bat itself. I have included a screenshot. 8445F589-0895-499A-BCD2-5A65765081AB_1_105_c

dustinblackman commented 8 months ago

Thanks for reporting!

This is a tricky one. It strictly depends on the syntax files, and the syntax highlighting library, both of which I'm using the exact same versions of both compared to Bat. I've tried messing around with changing the syntax files, but it doesn't seem to solve the issue.

I'll dig some more and see if I can figure it out.

ecthelionvi commented 8 months ago

I appreciate that! Thank you.

dustinblackman commented 8 months ago

Found it. Issue is due to how word wrapping conflicting with syntax highlighting. I have a WIP in progress that fixes it for languages I'm familiar with (Python included), but it'll likely break other stuff. It's not really elegant.

https://github.com/dustinblackman/oatmeal/compare/main...code-comment-word-wrapping-1?expand=1

I'll likely sit on this for a bit until I can consider a better way to handle this, possibly moving word wrapping to later in the flow.

image image
dustinblackman commented 8 months ago

Fixed in v0.12.1

ecthelionvi commented 8 months ago

Thank you 🙏