-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Djot support #12562
base: master
Are you sure you want to change the base?
Add Djot support #12562
Conversation
If it would make the reviewing process easier for someone who is unfamiliar with djot, here is an example file. I've had to change the extension to upload it to GitHub so it will need to be changed back to Additionally, here are some screenshots demonstrating the highlights: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see this, as I enjoy using Djot as well!
I was waiting for treeman/tree-sitter-djot#55 to be merged before starting this PR, but this already looks great to me!
(key_value "=" @operator) | ||
|
||
; NOTE: Not perfectly semantically accurate, but a fair approximation. | ||
(identifier) @string.special.symbol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally okay with variable
or variable.other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried a few things for identifiers and found that using more accurate scopes like type
or attribute
often made them indistinct from classes. Looking at variable
and variable.other
, there are a few themes where this looks nice but many of them have variables un-highlighted which kind of buries the identifiers by making them look like everything else.
My reasoning for using string.special.symbol
was to at least emphasise the idea that there is only one instance of this thing 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reasoning for using string.special.symbol was to at least emphasise the idea that there is only one instance of this thing
Understandable! However usually themes set the variable
to a color because of their own specific reasons, and it's always a toss-up if somebody prefers semantics over UX.
I don't have any strong preference here, I'm already glad this PR is up!
runtime/queries/djot/highlights.scm
Outdated
(quotation_marks) @markup.quote | ||
|
||
; INFO: `term` only matches on definition list items -- other list items won't be highlighted. | ||
(list_item (term) @type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is quite nice, I'd say constructor
makes sense for me here as well...but either LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the idea of using constructor for this! I'll quickly make that edit to this PR now 😄
b723e2c
to
d8a87af
Compare
This change adds support for the Djot markup language. The grammar used is tree-sitter-djot and the highlights & injections have been adapted for Helix's scopes.
There are 4 highlight queries with TEMP comments above them as they are semantically significant but I don't feel they have appropriate existing scopes.
In preparation for #9458 I will be maintaining a version with inverse precedence.
Closes #12264
Closes treeman/tree-sitter-djot#10