mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 10:56:19 +04:00
Add Groovy grammar (#9350)
* Add Groovy grammar * Rewrite Neovim captures into Helix for Groovy * Simplify Groovy injections Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Remove Neovim's spell from Groovy highlights Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Apply suggestions to languages.toml * Escape backslash in groovy highlights.scm --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
This commit is contained in:
parent
cdef4f8a70
commit
990378a46b
@ -65,6 +65,7 @@
|
|||||||
| gotmpl | ✓ | | | `gopls` |
|
| gotmpl | ✓ | | | `gopls` |
|
||||||
| gowork | ✓ | | | `gopls` |
|
| gowork | ✓ | | | `gopls` |
|
||||||
| graphql | ✓ | | | `graphql-lsp` |
|
| graphql | ✓ | | | `graphql-lsp` |
|
||||||
|
| groovy | ✓ | | | |
|
||||||
| hare | ✓ | | | |
|
| hare | ✓ | | | |
|
||||||
| haskell | ✓ | ✓ | | `haskell-language-server-wrapper` |
|
| haskell | ✓ | ✓ | | `haskell-language-server-wrapper` |
|
||||||
| haskell-persistent | ✓ | | | |
|
| haskell-persistent | ✓ | | | |
|
||||||
|
@ -3125,3 +3125,16 @@ indent = { tab-width = 2, unit = " " }
|
|||||||
[[grammar]]
|
[[grammar]]
|
||||||
name = "pkl"
|
name = "pkl"
|
||||||
source = { git = "https://github.com/apple/tree-sitter-pkl", rev = "c03f04a313b712f8ab00a2d862c10b37318699ae" }
|
source = { git = "https://github.com/apple/tree-sitter-pkl", rev = "c03f04a313b712f8ab00a2d862c10b37318699ae" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "groovy"
|
||||||
|
language-id = "groovy"
|
||||||
|
scope = "source.groovy"
|
||||||
|
file-types = ["groovy", "jenkinsfile", { glob = "Jenkinsfile" }, { glob = "Jenkinsfile.*" }]
|
||||||
|
shebangs = ["groovy"]
|
||||||
|
comment-token = "//"
|
||||||
|
indent = { tab-width = 2, unit = " " }
|
||||||
|
|
||||||
|
[[grammar]]
|
||||||
|
name = "groovy"
|
||||||
|
source = { git = "https://github.com/Decodetalkers/tree-sitter-groovy", rev = "7e023227f46fee428b16a0288eeb0f65ee2523ec" }
|
||||||
|
96
runtime/queries/groovy/highlights.scm
Normal file
96
runtime/queries/groovy/highlights.scm
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
(unit
|
||||||
|
(identifier) @variable)
|
||||||
|
|
||||||
|
(string
|
||||||
|
(identifier) @variable)
|
||||||
|
|
||||||
|
(escape_sequence) @constant.character.escape
|
||||||
|
|
||||||
|
(block
|
||||||
|
(unit
|
||||||
|
(identifier) @namespace))
|
||||||
|
|
||||||
|
(func
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
|
(number) @constant.numeric
|
||||||
|
|
||||||
|
((identifier) @constant.builtin.boolean
|
||||||
|
(#any-of? @constant.builtin.boolean "true" "false"))
|
||||||
|
|
||||||
|
((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||||
|
|
||||||
|
((identifier) @constant.builtin
|
||||||
|
(#eq? @constant.builtin "null"))
|
||||||
|
|
||||||
|
((identifier) @type
|
||||||
|
(#any-of? @type
|
||||||
|
"String"
|
||||||
|
"Map"
|
||||||
|
"Object"
|
||||||
|
"Boolean"
|
||||||
|
"Integer"
|
||||||
|
"List"))
|
||||||
|
|
||||||
|
((identifier) @function.builtin
|
||||||
|
(#any-of? @function.builtin
|
||||||
|
"void"
|
||||||
|
"id"
|
||||||
|
"version"
|
||||||
|
"apply"
|
||||||
|
"implementation"
|
||||||
|
"testImplementation"
|
||||||
|
"androidTestImplementation"
|
||||||
|
"debugImplementation"))
|
||||||
|
|
||||||
|
((identifier) @keyword.storage.modifier
|
||||||
|
(#eq? @keyword.storage.modifier "static"))
|
||||||
|
|
||||||
|
((identifier) @keyword.storage.type
|
||||||
|
(#any-of? @keyword.storage.type "class" "def" "interface"))
|
||||||
|
|
||||||
|
((identifier) @keyword
|
||||||
|
(#any-of? @keyword
|
||||||
|
"assert"
|
||||||
|
"new"
|
||||||
|
"extends"
|
||||||
|
"implements"
|
||||||
|
"instanceof"))
|
||||||
|
|
||||||
|
((identifier) @keyword.control.import
|
||||||
|
(#any-of? @keyword.control.import "import" "package"))
|
||||||
|
|
||||||
|
((identifier) @keyword.storage.modifier
|
||||||
|
(#any-of? @keyword.storage.modifier
|
||||||
|
"abstract"
|
||||||
|
"protected"
|
||||||
|
"private"
|
||||||
|
"public"))
|
||||||
|
|
||||||
|
((identifier) @keyword.control.exception
|
||||||
|
(#any-of? @keyword.control.exception
|
||||||
|
"throw"
|
||||||
|
"finally"
|
||||||
|
"try"
|
||||||
|
"catch"))
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
|
||||||
|
[
|
||||||
|
(line_comment)
|
||||||
|
(block_comment)
|
||||||
|
] @comment
|
||||||
|
|
||||||
|
((block_comment) @comment.block.documentation
|
||||||
|
(#match? @comment.block.documentation "^/[*][*][^*](?s:.)*[*]/$"))
|
||||||
|
|
||||||
|
((line_comment) @comment.block.documentation
|
||||||
|
(#match? @comment.block.documentation "^///[^/]*.*$"))
|
||||||
|
|
||||||
|
[
|
||||||
|
(operators)
|
||||||
|
(leading_key)
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
2
runtime/queries/groovy/injections.scm
Normal file
2
runtime/queries/groovy/injections.scm
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
([(line_comment) (block_comment)] @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
Loading…
Reference in New Issue
Block a user