-
-
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
Improved tree-sitter queries #896
Conversation
c7d8f86
to
ae5f949
Compare
(let_declaration | ||
pattern: [ | ||
((identifier) @variable) | ||
((tuple_pattern |
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.
Should this be pulled out to match all tuple_pattern
s? I don't know if there are any other cases where it's used that we probably don't want to highlight it as a variable. I'll do it later once I refactor highlights.scm
to completely cover all highlighting based on tree-sitter-rust/grammar.js
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.
Not sure, we could do that and simplify
Here's an example of atom's tree-sitter Rust grammar using it: https://github.com/atom/atom/blob/fd5577910528774b549e94407b555da89f55db79/packages/language-rust-bundled/grammars/tree-sitter-rust.cson#L39 |
I feel that people wouldn't understand what that means just by looking at it, versus |
A struct member is pretty common terminology. I'd rather stay in line with TextMate/Sublime scopes since that's what most grammars already use (including VSCode) |
I'm also looking at other grammars to see if |
variable.property -> variable.field property -> variable.field
Looks like |
The declaration is Result and Option are special cased https://github.com/microsoft/vscode/blob/e78e63fc3af3113d0a32cb479b8e7c232901d4e4/extensions/rust/syntaxes/rust.tmLanguage.json#L1018-L1031 |
You can use a scope inspector to see the scopes used, but I don't have VSCode installed: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#textmate-tokens-and-scopes |
I also found this: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#predefined-textmate-scope-mappings Based on your screenshot: Looks like the "textmate scopes" is simply I mean in cases like |
They're both styled as |
Yeah that's what I meant, it looks like definitions have different scopes from constructors/uses in code. Similar to Since we're already changing a couple scopes, let's also do:
That way we reduce the amount of top level scopes, making it easier to style in simple themes (you just need to define |
Just need to update the book. |
All the themes need to be updated to use these new scopes too. |
updated book and themes to reflect scope changes
@raygervais I noticed that "ui.popup" = { bg = "base01" }
"ui.window" = { bg = "base00" }
"ui.help" = { bg = "base01", fg = "base06" } have duplicated keys in |
How do I fix the submodule change? I don't know how that even happened. |
Is it the change with elixir ? #875 |
It's with cpp, presumably this happened when I did |
|
Doesn't seem like it. Maybe my case is different since I set |
Well now that you committed and pushed the submodule update it considers that to be what it's syncing to maybe? |
Ah sorry, was supposed to be |
How do you do that? |
b85754b
to
61d56c2
Compare
Curse you git... curse you. |
(false) | ||
] @constant.builtin.boolean | ||
(null) @constant.builtin | ||
(number) @constant.numeric |
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.
Maybe constant.numeric.integer
? I know it's not necessarily correct, but if someone defines constant.numeric.integer
and constant.numeric.float
but not constant.numeric
then this won't get highlighted.
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.
Though I guess we should just recommend styling constant.numeric
highlights.scm
@variable.property
->@variable.other.member
@property
->@variable.other.member
@number
->@constant.numeric.{integer, float}
@escape
->@constant.character.escape
@constant.character
is now uniformly used for all chars.