on master help sign in
Add textobject for gdscript (#3760)
a15420eErasin
book/src/generated/lang-support.md+1−1
@@ -29,7 +29,7 @@
29| esdl | ✓ | | | |
29| esdl | ✓ | | | |
30| fish | ✓ | ✓ | ✓ | |
30| fish | ✓ | ✓ | ✓ | |
31| fortran | ✓ | | ✓ | `fortls` |
31| fortran | ✓ | | ✓ | `fortls` |
32−| gdscript | ✓ | | | |
32+| gdscript | ✓ | ✓ | | |
33| git-attributes | ✓ | | | |
33| git-attributes | ✓ | | | |
34| git-commit | ✓ | | | |
34| git-commit | ✓ | | | |
35| git-config | ✓ | | | |
35| git-config | ✓ | | | |
languages.toml+1−1
@@ -1327,7 +1327,7 @@ shebangs = []
1327roots = ["project.godot"]
1327roots = ["project.godot"]
1328auto-format = true
1328auto-format = true
1329comment-token = "#"
1329comment-token = "#"
1330−indent = { tab-width = 4, unit = " " }
1330+indent = { tab-width = 4, unit = "\t" }
1331
1331
1332[[grammar]]
1332[[grammar]]
1333name = "gdscript"
1333name = "gdscript"
runtime/queries/gdscript/highlights.scm+5
@@ -3,6 +3,11 @@
3((identifier) @constant
3((identifier) @constant
4 (#match? @constant "^[A-Z][A-Z_]*$"))
4 (#match? @constant "^[A-Z][A-Z_]*$"))
5
5
6+; class
7+(class_name_statement (name) @type)
8+(class_definition (name) @type)
9+
10+
6; Function calls
11; Function calls
7
12
8(attribute_call (identifier) @function)
13(attribute_call (identifier) @function)
runtime/queries/gdscript/textobjects.scmnew file+17
@@ -0,0 +1,17 @@
1+
2+(class_definition
3+ (body) @class.inside) @class.around
4+
5+(function_definition
6+ (body) @function.inside) @function.around
7+
8+(parameters
9+ [
10+ (identifier)
11+ (typed_parameter)
12+ (default_parameter)
13+ (typed_default_parameter)
14+ ] @parameter.inside @parameter.around)
15+
16+(comment) @comment.inside
17+(comment)+ @comment.around