Skip to content

Commit

Permalink
Add textobject for gdscript (helix-editor#3760)
Browse files Browse the repository at this point in the history
  • Loading branch information
erasin authored Sep 10, 2022
1 parent 54e78dd commit a15420e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
| esdl || | | |
| fish |||| |
| fortran || || `fortls` |
| gdscript || | | |
| gdscript || | | |
| git-attributes || | | |
| git-commit || | | |
| git-config || | | |
Expand Down
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ shebangs = []
roots = ["project.godot"]
auto-format = true
comment-token = "#"
indent = { tab-width = 4, unit = " " }
indent = { tab-width = 4, unit = "\t" }

[[grammar]]
name = "gdscript"
Expand Down
5 changes: 5 additions & 0 deletions runtime/queries/gdscript/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
((identifier) @constant
(#match? @constant "^[A-Z][A-Z_]*$"))

; class
(class_name_statement (name) @type)
(class_definition (name) @type)


; Function calls

(attribute_call (identifier) @function)
Expand Down
17 changes: 17 additions & 0 deletions runtime/queries/gdscript/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

(class_definition
(body) @class.inside) @class.around

(function_definition
(body) @function.inside) @function.around

(parameters
[
(identifier)
(typed_parameter)
(default_parameter)
(typed_default_parameter)
] @parameter.inside @parameter.around)

(comment) @comment.inside
(comment)+ @comment.around

0 comments on commit a15420e

Please sign in to comment.