on master help sign in
Update grammar for godot (#5944)

* update grammar for gdscript. * add comment injections for gdscript. * add indent for gdscript * add file-type support for godot-resource

commitc71b4c5579fdc753e62300f5ee6ca5e747a98e13 authorErasin <erasinoo@gmail.com> dateMon 13 Feb 2023, 04:03 (4 years ago) parentef221ab
6 files changed+44−4
book/src/generated/lang-support.md+1−1 languages.toml+2−2 runtime/queries/gdscript/indents.scm+35 runtime/queries/gdscript/injections.scm+2 runtime/queries/godot-resource/highlights.scm+2−1 runtime/queries/godot-resource/injections.scm+2
book/src/generated/lang-support.md+1−1
@@ -38,7 +38,7 @@
3838| esdl | ✓ | | | |
3939| fish | ✓ | ✓ | ✓ | |
4040| fortran | ✓ | | ✓ | `fortls` |
41−| gdscript | ✓ | ✓ | | |
41+| gdscript | ✓ | ✓ | ✓ | |
4242| git-attributes | ✓ | | | |
4343| git-commit | ✓ | | | |
4444| git-config | ✓ | | | |
languages.toml+2−2
@@ -1449,13 +1449,13 @@ indent = { tab-width = 4, unit = "\t" }
14491449
14501450[[grammar]]
14511451name = "gdscript"
1452−source = { git = "https://github.com/PrestonKnopp/tree-sitter-gdscript", rev = "2a6abdaa47fcb91397e09a97c7433fd995ea46c6" }
1452+source = { git = "https://github.com/PrestonKnopp/tree-sitter-gdscript", rev = "a56a6fcec3fb63ec3324bf9373aae7298861eb30" }
14531453
14541454[[language]]
14551455name = "godot-resource"
14561456scope = "source.tscn"
14571457injection-regex = "godot"
1458−file-types = ["tscn","tres"]
1458+file-types = ["tscn", "tres", "godot", "gdextension"]
14591459shebangs = []
14601460roots = ["project.godot"]
14611461auto-format = false
runtime/queries/gdscript/indents.scmnew file+35
@@ -0,0 +1,35 @@
1+[
2+ (if_statement)
3+ (for_statement)
4+ (while_statement)
5+ (match_statement)
6+ (pattern_section)
7+
8+ (function_definition)
9+ (constructor_definition)
10+ (class_definition)
11+ (enum_definition)
12+
13+ (dictionary (_))
14+ (array (_))
15+] @indent
16+
17+[
18+ (if_statement)
19+ (for_statement)
20+ (while_statement)
21+ (match_statement)
22+ (pattern_section)
23+
24+ (function_definition)
25+ (class_definition)
26+] @extend
27+
28+
29+[
30+ (return_statement)
31+ (break_statement)
32+ (continue_statement)
33+ (pass_statement)
34+] @extend.prevent-once
35+
runtime/queries/gdscript/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/godot-resource/highlights.scm+2−1
@@ -25,4 +25,5 @@
2525
2626"=" @operator
2727
28−(ERROR) @error
28+(ERROR) @error
29+(comment) @comment
runtime/queries/godot-resource/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))