mirror of
https://github.com/nvim-treesitter/nvim-treesitter-context
synced 2024-09-16 22:24:04 +02:00
feat: gdscript support
This commit is contained in:
parent
2484f58384
commit
ce37c77155
3 changed files with 144 additions and 0 deletions
|
@ -33,6 +33,7 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
|
|||
- [x] `fennel`
|
||||
- [x] `fish`
|
||||
- [x] `fortran`
|
||||
- [x] `gdscript`
|
||||
- [x] `glimmer`
|
||||
- [x] `go`
|
||||
- [x] `graphql`
|
||||
|
|
40
queries/gdscript/context.scm
Normal file
40
queries/gdscript/context.scm
Normal file
|
@ -0,0 +1,40 @@
|
|||
(function_definition
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(if_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(elif_clause
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(else_clause
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(for_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(while_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(class_definition
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(match_statement
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(pattern_section
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
||||
(enum_definition
|
||||
body: (_) @context.end
|
||||
) @context
|
||||
|
103
test/test.gd
Normal file
103
test/test.gd
Normal file
|
@ -0,0 +1,103 @@
|
|||
enum Test {
|
||||
|
||||
|
||||
VALUE1,
|
||||
|
||||
|
||||
|
||||
VALUE2,
|
||||
|
||||
|
||||
|
||||
VALUE3,
|
||||
|
||||
|
||||
}
|
||||
|
||||
func test_function():
|
||||
|
||||
|
||||
|
||||
var test_value = Test.Value1
|
||||
|
||||
|
||||
if test_value = Test.VALUE1:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# do nothing
|
||||
pass
|
||||
|
||||
elif test_value = Test.VALUE2:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for i in 5:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# do nothing 5 times
|
||||
pass
|
||||
|
||||
else:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
while true:
|
||||
|
||||
|
||||
|
||||
|
||||
# do nothing forever
|
||||
pass
|
||||
|
||||
match test_value:
|
||||
Test.VALUE1:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print("foo")
|
||||
|
||||
Test.VALUE2:
|
||||
|
||||
|
||||
|
||||
|
||||
print("bar")
|
||||
|
||||
class HelpClass:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var class_variable
|
||||
func class_function():
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print("foobar")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue