Updated Godot support (#11235)

- update gdscript highlights
- add godot-resource textobjects
pull/11339/merge
Erasin Wang 2 months ago committed by GitHub
parent a4cfcff284
commit b19551b11b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -69,7 +69,7 @@
| glsl | ✓ | ✓ | ✓ | | | glsl | ✓ | ✓ | ✓ | |
| gn | ✓ | | | | | gn | ✓ | | | |
| go | ✓ | ✓ | ✓ | `gopls`, `golangci-lint-langserver` | | go | ✓ | ✓ | ✓ | `gopls`, `golangci-lint-langserver` |
| godot-resource | ✓ | | | | | godot-resource | ✓ | | | |
| gomod | ✓ | | | `gopls` | | gomod | ✓ | | | `gopls` |
| gotmpl | ✓ | | | `gopls` | | gotmpl | ✓ | | | `gopls` |
| gowork | ✓ | | | `gopls` | | gowork | ✓ | | | `gopls` |

@ -1995,12 +1995,12 @@ shebangs = []
roots = ["project.godot"] roots = ["project.godot"]
auto-format = true auto-format = true
formatter = { command = "gdformat", args = ["-"] } formatter = { command = "gdformat", args = ["-"] }
comment-token = "#" comment-tokens = ["#", "##"]
indent = { tab-width = 4, unit = "\t" } indent = { tab-width = 4, unit = "\t" }
[[grammar]] [[grammar]]
name = "gdscript" name = "gdscript"
source = { git = "https://github.com/PrestonKnopp/tree-sitter-gdscript", rev = "a4b57cc3bcbfc24550e858159647e9238e7ad1ac" } source = { git = "https://github.com/PrestonKnopp/tree-sitter-gdscript", rev = "1f1e782fe2600f50ae57b53876505b8282388d77" }
[[language]] [[language]]
name = "godot-resource" name = "godot-resource"
@ -2015,7 +2015,7 @@ indent = { tab-width = 4, unit = "\t" }
[[grammar]] [[grammar]]
name = "godot-resource" name = "godot-resource"
source = { git = "https://github.com/PrestonKnopp/tree-sitter-godot-resource", rev = "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" } source = { git = "https://github.com/PrestonKnopp/tree-sitter-godot-resource", rev = "2ffb90de47417018651fc3b970e5f6b67214dc9d" }
[[language]] [[language]]
name = "nu" name = "nu"

@ -14,6 +14,7 @@
(attribute_call (identifier) @function) (attribute_call (identifier) @function)
(base_call (identifier) @function) (base_call (identifier) @function)
(call (identifier) @function) (call (identifier) @function)
(lambda (name) @function)
; Function definitions ; Function definitions
@ -88,6 +89,7 @@
"<<" "<<"
">>" ">>"
":=" ":="
":"
] @operator ] @operator
(annotation (identifier) @keyword.storage.modifier) (annotation (identifier) @keyword.storage.modifier)
@ -97,6 +99,7 @@
"else" "else"
"elif" "elif"
"match" "match"
"when"
] @keyword.control.conditional ] @keyword.control.conditional
[ [

@ -6,6 +6,7 @@
(pattern_section) (pattern_section)
(function_definition) (function_definition)
(lambda)
(constructor_definition) (constructor_definition)
(class_definition) (class_definition)
(enum_definition) (enum_definition)

@ -5,6 +5,8 @@
(function_definition (function_definition
(body) @function.inside) @function.around (body) @function.inside) @function.around
(lambda (body) @function.inside) @function.around
(parameters (parameters
[ [
(identifier) (identifier)
@ -15,5 +17,12 @@
(arguments (_expression) @parameter.inside @parameter.around) (arguments (_expression) @parameter.inside @parameter.around)
[
(const_statement)
(variable_statement)
(pair)
(enumerator)
] @entry.around
(comment) @comment.inside (comment) @comment.inside
(comment)+ @comment.around (comment)+ @comment.around

@ -11,8 +11,41 @@
(property (property
(path) @_is_code (path) @_is_code
(string) @injection.content)) (string) @injection.content))
(#match? @_type "type") (#eq? @_type "type")
(#match? @_is_shader "Shader") (#match? @_is_shader "Shader")
(#eq? @_is_code "code") (#eq? @_is_code "code")
(#set! injection.language "glsl") (#set! injection.language "glsl")
) )
((section
(identifier) @_is_resource
(property
(path) @_is_code
(string) @injection.content))
(#eq? @_is_resource "resource")
(#eq? @_is_code "code")
(#set! injection.language "glsl")
)
((section
(identifier) @_id
(property
(path) @_is_expression
(string) @injection.content))
(#eq? @_id "sub_resource")
(#eq? @_is_expression "expression")
(#set! injection.language "glsl")
)
((section
(attribute
(identifier) @_type
(string) @_is_shader)
(property
(path) @_is_code
(string) @injection.content))
(#eq? @_type "type")
(#match? @_is_shader "GDScript")
(#eq? @_is_code "script/source")
(#set! injection.language "gdscript")
)

@ -0,0 +1,23 @@
(section
(identifier)
(_)
(property) @class.inside
) @class.around
(attribute
(identifier)
(_) @parameter.inside) @parameter.around
(property
(path)
(_) @entry.inside) @entry.around
(pair
(_) @entry.inside) @entry.around
(array
(_) @entry.around)
(comment) @comment.inside
(comment)+ @comment.around
Loading…
Cancel
Save