diff options
author | BooksBaum <15612932+Booksbaum@users.noreply.github.com> | 2023-07-28 17:06:08 +0200 |
---|---|---|
committer | ryanabx <ryanbrue@hotmail.com> | 2023-09-11 09:46:34 -0500 |
commit | 0202a36a7a0eb76dec9814728e30e00074dc7bb2 (patch) | |
tree | 1628450e38be206c3b951652a7934f5a740c2888 /modules/gdscript/tests/scripts/lsp/scopes.notest.gd | |
parent | 221884e6bc260c38f16422081b7d4efd49a71375 (diff) | |
download | redot-engine-0202a36a7a0eb76dec9814728e30e00074dc7bb2.tar.gz |
Language Server: Improve hovered symbol resolution, fix renaming bugs, implement reference lookup
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
Co-Authored-By: BooksBaum <15612932+booksbaum@users.noreply.github.com>
Diffstat (limited to 'modules/gdscript/tests/scripts/lsp/scopes.notest.gd')
-rw-r--r-- | modules/gdscript/tests/scripts/lsp/scopes.notest.gd | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/lsp/scopes.notest.gd b/modules/gdscript/tests/scripts/lsp/scopes.notest.gd new file mode 100644 index 0000000000..20b8fb9bd7 --- /dev/null +++ b/modules/gdscript/tests/scripts/lsp/scopes.notest.gd @@ -0,0 +1,106 @@ +extends Node + +var member := 2 +# ^^^^^^ public -> public + +signal some_changed(new_value) +# | | ^^^^^^^^^ signal:parameter -> signal:parameter +# ^^^^^^^^^^^^ signal -> signal +var some_value := 42: +# ^^^^^^^^^^ property -> property + get: + return some_value + # ^^^^^^^^^^ -> property + set(value): + # ^^^^^ property:set:value -> property:set:value + some_changed.emit(value) + # | ^^^^^ -> property:set:value + #<^^^^^^^^^^ -> signal + some_value = value + # | ^^^^^ -> property:set:value + #<^^^^^^^^ -> property + +func v(): + var value := member + 2 + # | | ^^^^^^ -> public + # ^^^^^ v:value -> v:value + print(value) + # ^^^^^ -> v:value + if value > 0: + # ^^^^^ -> v:value + var beta := value + 2 + # | | ^^^^^ -> v:value + # ^^^^ v:if:beta -> v:if:beta + print(beta) + # ^^^^ -> v:if:beta + + for counter in beta: + # | | ^^^^ -> v:if:beta + # ^^^^^^^ v:if:counter -> v:if:counter + print (counter) + # ^^^^^^^ -> v:if:counter + + else: + for counter in value: + # | | ^^^^^ -> v:value + # ^^^^^^^ v:else:counter -> v:else:counter + print(counter) + # ^^^^^^^ -> v:else:counter + +func f(): + var func1 = func(value): print(value + 13) + # | | | | ^^^^^ -> f:func1:value + # | | ^^^^^ f:func1:value -> f:func1:value + # ^^^^^ f:func1 -> f:func1 + var func2 = func(value): print(value + 42) + # | | | | ^^^^^ -> f:func2:value + # | | ^^^^^ f:func2:value -> f:func2:value + # ^^^^^ f:func2 -> f:func2 + + func1.call(1) + #<^^^ -> f:func1 + func2.call(2) + #<^^^ -> f:func2 + +func m(): + var value = 42 + # ^^^^^ m:value -> m:value + + match value: + # ^^^^^ -> m:value + 13: + print(value) + # ^^^^^ -> m:value + [var start, _, var end]: + # | | ^^^ m:match:array:end -> m:match:array:end + # ^^^^^ m:match:array:start -> m:match:array:start + print(start + end) + # | | ^^^ -> m:match:array:end + # ^^^^^ -> m:match:array:start + { "name": var name }: + # ^^^^ m:match:dict:var -> m:match:dict:var + print(name) + # ^^^^ -> m:match:dict:var + var whatever: + # ^^^^^^^^ m:match:var -> m:match:var + print(whatever) + # ^^^^^^^^ -> m:match:var + +func m2(): + var value = 42 + # ^^^^^ m2:value -> m2:value + + match value: + # ^^^^^ -> m2:value + { "name": var name }: + # ^^^^ m2:match:dict:var -> m2:match:dict:var + print(name) + # ^^^^ -> m2:match:dict:var + [var name, ..]: + # ^^^^ m2:match:array:var -> m2:match:array:var + print(name) + # ^^^^ -> m2:match:array:var + var name: + # ^^^^ m2:match:var -> m2:match:var + print(name) + # ^^^^ -> m2:match:var |