diff options
| author | Ryan Roden-Corrent <ryan@rcorre.net> | 2022-01-23 13:44:36 -0500 |
|---|---|---|
| committer | Christian Clason <christian.clason@uni-due.de> | 2022-01-24 13:11:01 +0100 |
| commit | f67eb83be5f8c49f1a7621553458227b786b1b0c (patch) | |
| tree | 9fc4e598687766013c479d8c360d92688b4f3839 /queries/gdscript | |
| parent | Update lockfile.json (diff) | |
| download | nvim-treesitter-f67eb83be5f8c49f1a7621553458227b786b1b0c.tar nvim-treesitter-f67eb83be5f8c49f1a7621553458227b786b1b0c.tar.gz nvim-treesitter-f67eb83be5f8c49f1a7621553458227b786b1b0c.tar.bz2 nvim-treesitter-f67eb83be5f8c49f1a7621553458227b786b1b0c.tar.lz nvim-treesitter-f67eb83be5f8c49f1a7621553458227b786b1b0c.tar.xz nvim-treesitter-f67eb83be5f8c49f1a7621553458227b786b1b0c.tar.zst nvim-treesitter-f67eb83be5f8c49f1a7621553458227b786b1b0c.zip | |
feat(indent): Implement basic indent for gdscript.
Indent is not handled correctly when adding new lines.
It seems that functions/loops/etc. are not recognized until they have at
least one indented block.
For example, if you enter a newline after `func foo():`, the cursor will
not be indented. If you manually indent and add a line like `pass`,
e.g.:
```
func foo():
pass
```
now any insertions above or below `pass` will be indented correctly.
This might be an issue with the grammar, as it seems to apply to highlights
as well.
The following will not be highligted
```
func foo():
```
However, the following will be:
```
func foo():
pass
```
Diffstat (limited to 'queries/gdscript')
| -rw-r--r-- | queries/gdscript/indents.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/queries/gdscript/indents.scm b/queries/gdscript/indents.scm new file mode 100644 index 000000000..80b78234d --- /dev/null +++ b/queries/gdscript/indents.scm @@ -0,0 +1,24 @@ +[ + (if_statement) + + (for_statement) + (while_statement) + + (parenthesized_expression) + + (function_definition) + (class_definition) +] @indent + +((argument_list) @aligned_indent + (#set! "delimiter" "()")) +((parameters) @aligned_indent + (#set! "delimiter" "()")) + +[ + ")" + "]" + "}" + (elif_clause) + (else_clause) +] @branch |
