Conversation
|
@microsoft-github-policy-service agree |
lhecker
left a comment
There was a problem hiding this comment.
Thank you for contributing this! I'll review this in due time.
To me this PR looks like a solid start with just minor nits perhaps. For instance, at a quick glance I saw the "asm" keyword in the cpp definitions which isn't an official keyword. In the future we could consider adding more complex rules like implementing proper highlighting for struct members or variables. A good reference will be https://github.com/microsoft/vscode/blob/main/extensions/cpp/syntaxes/c.tmLanguage.json and the corresponding cpp file.
|
https://en.cppreference.com/w/c/keyword.html These are what I used for the keyword lists, though I did run them through an LLM ("which of these should I include in the highlighter") since I can't exactly claim to be an expert on the languages 😅 but yeah, the VSCode lists are probably the right way to go here. |
|
I think replicating the VS Code rules as-is wouldn't be a good idea: They're sometimes very complex because they're defined in a very simple DSL. LSH is much more powerful (or will be in the future if we want to) and so we can express some things much more easily. There are also some constructs which are rather niche and we don't necessarily need for a simpler editor. But I like using them as a nice guideline for what it could be and to collect overall ideas. 🙂 |
This adds initial LSH syntax highlighting support for:
It also updates Markdown fenced code block routing accordingly.
Scope
This is a lightweight LSH-only change with no new dependencies.
The changes are limited to syntax definitions and highlighting fixtures:
Validation
cargo test -qNotes
You may notice this PR is heavily inspired by and modelled after #791. I really like this project but unfortunately don't know any Rust so I figured this would be the best way for me to contribute.