bash, make, css: highlight and indent queries improvement (#9393)
* highlights(bash): rework keywords section * Use more specified scope when possible for keywords like @keyword.repeat. * Add more keywords like "local" or "unsetenv". Limitation: * Bash doesn't allow you to have a local variable outside of a function, so maybe we need to have better queries to not highlight the local in this case. * If we name a function with a keyword (such as unset or local), it will use the highlight scope "keyword" instead of "function". * indents(css, make): add basic queries * Despite the fact that queries look simple, they improve indentation in some edge cases that helix couldn't handle correctly by default.
This commit is contained in:
parent
f5f08becef
commit
52a43bcdfc
4 changed files with 42 additions and 13 deletions
|
@ -21,7 +21,7 @@
|
||||||
| cpon | ✓ | | ✓ | |
|
| cpon | ✓ | | ✓ | |
|
||||||
| cpp | ✓ | ✓ | ✓ | `clangd` |
|
| cpp | ✓ | ✓ | ✓ | `clangd` |
|
||||||
| crystal | ✓ | ✓ | | `crystalline` |
|
| crystal | ✓ | ✓ | | `crystalline` |
|
||||||
| css | ✓ | | | `vscode-css-language-server` |
|
| css | ✓ | | ✓ | `vscode-css-language-server` |
|
||||||
| cue | ✓ | | | `cuelsp` |
|
| cue | ✓ | | | `cuelsp` |
|
||||||
| d | ✓ | ✓ | ✓ | `serve-d` |
|
| d | ✓ | ✓ | ✓ | `serve-d` |
|
||||||
| dart | ✓ | | ✓ | `dart` |
|
| dart | ✓ | | ✓ | `dart` |
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
| log | ✓ | | | |
|
| log | ✓ | | | |
|
||||||
| lpf | ✓ | | | |
|
| lpf | ✓ | | | |
|
||||||
| lua | ✓ | ✓ | ✓ | `lua-language-server` |
|
| lua | ✓ | ✓ | ✓ | `lua-language-server` |
|
||||||
| make | ✓ | | | |
|
| make | ✓ | | ✓ | |
|
||||||
| markdoc | ✓ | | | `markdoc-ls` |
|
| markdoc | ✓ | | | `markdoc-ls` |
|
||||||
| markdown | ✓ | | | `marksman` |
|
| markdown | ✓ | | | `marksman` |
|
||||||
| markdown.inline | ✓ | | | |
|
| markdown.inline | ✓ | | | |
|
||||||
|
|
|
@ -10,23 +10,37 @@
|
||||||
(variable_name) @variable.other.member
|
(variable_name) @variable.other.member
|
||||||
|
|
||||||
[
|
[
|
||||||
|
"if"
|
||||||
|
"then"
|
||||||
|
"else"
|
||||||
|
"elif"
|
||||||
|
"fi"
|
||||||
"case"
|
"case"
|
||||||
|
"in"
|
||||||
|
"esac"
|
||||||
|
] @keyword.control.conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
"for"
|
||||||
"do"
|
"do"
|
||||||
"done"
|
"done"
|
||||||
"elif"
|
"select"
|
||||||
"else"
|
"until"
|
||||||
"esac"
|
|
||||||
"export"
|
|
||||||
"fi"
|
|
||||||
"for"
|
|
||||||
"function"
|
|
||||||
"if"
|
|
||||||
"in"
|
|
||||||
"unset"
|
|
||||||
"while"
|
"while"
|
||||||
"then"
|
] @keyword.control.repeat
|
||||||
|
|
||||||
|
[
|
||||||
|
"declare"
|
||||||
|
"typeset"
|
||||||
|
"export"
|
||||||
|
"readonly"
|
||||||
|
"local"
|
||||||
|
"unset"
|
||||||
|
"unsetenv"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
"function" @keyword.function
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
(function_definition name: (word) @function)
|
(function_definition name: (word) @function)
|
||||||
|
|
7
runtime/queries/css/indents.scm
Normal file
7
runtime/queries/css/indents.scm
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[
|
||||||
|
(block)
|
||||||
|
] @indent
|
||||||
|
|
||||||
|
[
|
||||||
|
"}"
|
||||||
|
] @outdent
|
8
runtime/queries/make/indents.scm
Normal file
8
runtime/queries/make/indents.scm
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[
|
||||||
|
(define_directive)
|
||||||
|
(rule)
|
||||||
|
] @indent
|
||||||
|
|
||||||
|
[
|
||||||
|
"endef"
|
||||||
|
] @outdent
|
Loading…
Add table
Reference in a new issue