Skip to content

Conversation

@lhecker
Copy link
Member

@lhecker lhecker commented Aug 25, 2025

This adds syntax highlighting for git commit and rebase messages.
Support for other languages is on hold until I finished writing a
proper VM for executing the highlighting instructions.

Closes #18

@lhecker lhecker changed the title Move build.rs into its own directory A first draft for simple syntax highlighting Aug 25, 2025
Base automatically changed from dev/lhecker/build-system to main August 25, 2025 17:54
@MamiyaOtaru
Copy link

looking forward to the other languages. they seemed to work well enough in https://github.com/microsoft/edit/tree/4f36e2afe2a84ed339829ea6c63242fb9f4b7de3 (well, really long Here Strings made the rest of the file red, but ones with a reasonable length were fine)
image

@trumblejoe
Copy link

PR awaiting 2 pending checks still.

@lhecker
Copy link
Member Author

lhecker commented Oct 27, 2025

Working on this feature? In the current economy?!
(I'll try...)

@Consolatis
Copy link

Consolatis commented Oct 28, 2025

Thanks for your work on this. I've played around with this branch a bit and want to share my thoughts on the current implementation.

I tried to hack together basic C highlighting and noticed there is some state missing for "constants" (convention with all-uppercase variables usually defined with #define or part of some enum, not usual variables defined with const). Those are neither a Keyword nor a Variable.

Could the regexes be loaded from a file in the future? It might save some work to implement the basic functionality now by parsing a hardcoded string rather than defining everything in build/lsh/definitions.rs in rust code. Then it just needs the decision of what file(s) and from where to load + implement the actual file loading at a later point.

Another thing I wondered about is why the HighlightKind enum contains any colors, I have a feeling that those should be translated by themes from states like Comment or String.

Edit:
Some more feedback: support for Look::WordAscii (\b) and/or Look::WordStartAscii (\<) + Look::WordEndAscii (\>) would be very useful. Currently I can differentiate between break and breakage but not between break and unbreak. I've tried to implement it myself in build/lsh/compiler.rs but I am not familiar enough with rust and the regex-syntax crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add simple syntax highlighting

5 participants