cbrewster / brewcode

Brew(ster) code editor
MIT License
19 stars 3 forks source link

Improve syntax highlighting #9

Open cbrewster opened 4 years ago

cbrewster commented 4 years ago

I put in text highlighting really quickly for fun, but it is done in a very slow and hackish way. It is hardcoded to only do Rust syntax highlighting instead of trying to match the file extensions and text highlighting is recomputed for the entire buffer any time a change is made to the buffer.

I am using syntect for syntax highlighting and it allows for incrementally recomputing syntax highlighting. For example, usually the text highlighting preceding an edit stays the same so that portion can be skipped. Syntect has a way to save snapshots of the highlighter state which can be used to do this incremental re-computation.