initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
139
modules/gdscript/tests/scripts/lsp/class.gd
Normal file
139
modules/gdscript/tests/scripts/lsp/class.gd
Normal file
@@ -0,0 +1,139 @@
|
||||
extends Node
|
||||
|
||||
class Inner1 extends Node:
|
||||
# ^^^^^^ class1 -> class1
|
||||
var member1 := 42
|
||||
# ^^^^^^^ class1:member1 -> class1:member1
|
||||
var member2 : int = 13
|
||||
# ^^^^^^^ class1:member2 -> class1:member2
|
||||
var member3 = 1337
|
||||
# ^^^^^^^ class1:member3 -> class1:member3
|
||||
|
||||
signal changed(old, new)
|
||||
# ^^^^^^^ class1:signal -> class1:signal
|
||||
func my_func(arg1: int, arg2: String, arg3):
|
||||
# | | | | | | ^^^^ class1:func:arg3 -> class1:func:arg3
|
||||
# | | | | ^^^^ class1:func:arg2 -> class1:func:arg2
|
||||
# | | ^^^^ class1:func:arg1 -> class1:func:arg1
|
||||
# ^^^^^^^ class1:func -> class1:func
|
||||
print(arg1, arg2, arg3)
|
||||
# | | | | ^^^^ -> class1:func:arg3
|
||||
# | | ^^^^ -> class1:func:arg2
|
||||
# ^^^^ -> class1:func:arg1
|
||||
changed.emit(arg1, arg3)
|
||||
# | | | ^^^^ -> class1:func:arg3
|
||||
# | ^^^^ -> class1:func:arg1
|
||||
#<^^^^^ -> class1:signal
|
||||
return arg1 + arg2.length() + arg3
|
||||
# | | | | ^^^^ -> class1:func:arg3
|
||||
# | | ^^^^ -> class1:func:arg2
|
||||
# ^^^^ -> class1:func:arg1
|
||||
|
||||
class Inner2:
|
||||
# ^^^^^^ class2 -> class2
|
||||
var member1 := 42
|
||||
# ^^^^^^^ class2:member1 -> class2:member1
|
||||
var member2 : int = 13
|
||||
# ^^^^^^^ class2:member2 -> class2:member2
|
||||
var member3 = 1337
|
||||
# ^^^^^^^ class2:member3 -> class2:member3
|
||||
|
||||
signal changed(old, new)
|
||||
# ^^^^^^^ class2:signal -> class2:signal
|
||||
func my_func(arg1: int, arg2: String, arg3):
|
||||
# | | | | | | ^^^^ class2:func:arg3 -> class2:func:arg3
|
||||
# | | | | ^^^^ class2:func:arg2 -> class2:func:arg2
|
||||
# | | ^^^^ class2:func:arg1 -> class2:func:arg1
|
||||
# ^^^^^^^ class2:func -> class2:func
|
||||
print(arg1, arg2, arg3)
|
||||
# | | | | ^^^^ -> class2:func:arg3
|
||||
# | | ^^^^ -> class2:func:arg2
|
||||
# ^^^^ -> class2:func:arg1
|
||||
changed.emit(arg1, arg3)
|
||||
# | | | ^^^^ -> class2:func:arg3
|
||||
# | ^^^^ -> class2:func:arg1
|
||||
#<^^^^^ -> class2:signal
|
||||
return arg1 + arg2.length() + arg3
|
||||
# | | | | ^^^^ -> class2:func:arg3
|
||||
# | | ^^^^ -> class2:func:arg2
|
||||
# ^^^^ -> class2:func:arg1
|
||||
|
||||
class Inner三 extends Inner2:
|
||||
# | | ^^^^^^ -> class2
|
||||
# ^^^^^^ class3 -> class3
|
||||
var whatever = "foo"
|
||||
# ^^^^^^^^ class3:whatever -> class3:whatever
|
||||
|
||||
var ütf8 = ""
|
||||
# ^^^^ class3:utf8 -> class3:utf8
|
||||
|
||||
func _init():
|
||||
# ^^^^^ class3:init
|
||||
# Note: no self-ref check here: resolves to `Object._init`.
|
||||
# usages of `Inner三.new()` DO resolve to this `_init`
|
||||
pass
|
||||
|
||||
class NestedInInner3:
|
||||
# ^^^^^^^^^^^^^^ class3:nested1 -> class3:nested1
|
||||
var some_value := 42
|
||||
# ^^^^^^^^^^ class3:nested1:some_value -> class3:nested1:some_value
|
||||
|
||||
class AnotherNestedInInner3 extends NestedInInner3:
|
||||
#! | | ^^^^^^^^^^^^^^ -> class3:nested1
|
||||
# ^^^^^^^^^^^^^^^^^^^^^ class3:nested2 -> class3:nested2
|
||||
var another_value := 13
|
||||
# ^^^^^^^^^^^^^ class3:nested2:another_value -> class3:nested2:another_value
|
||||
|
||||
func _ready():
|
||||
var inner1 = Inner1.new()
|
||||
# | | ^^^^^^ -> class1
|
||||
# ^^^^^^ func:class1 -> func:class1
|
||||
var value1 = inner1.my_func(1,"",3)
|
||||
# | | | | ^^^^^^^ -> class1:func
|
||||
# | | ^^^^^^ -> func:class1
|
||||
# ^^^^^^ func:class1:value1 -> func:class1:value1
|
||||
var value2 = inner1.member3
|
||||
# | | | | ^^^^^^^ -> class1:member3
|
||||
# | | ^^^^^^ -> func:class1
|
||||
# ^^^^^^ func:class1:value2 -> func:class1:value2
|
||||
print(value1, value2)
|
||||
# | | ^^^^^^ -> func:class1:value2
|
||||
# ^^^^^^ -> func:class1:value1
|
||||
|
||||
var inner3 = Inner三.new()
|
||||
# | | | | ^^^ -> class3:init
|
||||
# | | ^^^^^^ -> class3
|
||||
# ^^^^^^ func:class3 -> func:class3
|
||||
print(inner3)
|
||||
# ^^^^^^ -> func:class3
|
||||
|
||||
print(inner3.ütf8)
|
||||
# | | ^^^^ -> class3:utf8
|
||||
# ^^^^^^ -> func:class3
|
||||
|
||||
var nested1 = Inner三.NestedInInner3.new()
|
||||
# | | | | ^^^^^^^^^^^^^^ -> class3:nested1
|
||||
# | | ^^^^^^ -> class3
|
||||
# ^^^^^^^ func:class3:nested1 -> func:class3:nested1
|
||||
var value_nested1 = nested1.some_value
|
||||
# | | | | ^^^^^^^^^^ -> class3:nested1:some_value
|
||||
# | | ^^^^^^^ -> func:class3:nested1
|
||||
# ^^^^^^^^^^^^^ func:class3:nested1:value
|
||||
print(value_nested1)
|
||||
# ^^^^^^^^^^^^^ -> func:class3:nested1:value
|
||||
|
||||
var nested2 = Inner三.AnotherNestedInInner3.new()
|
||||
# | | | | ^^^^^^^^^^^^^^^^^^^^^ -> class3:nested2
|
||||
# | | ^^^^^^ -> class3
|
||||
# ^^^^^^^ func:class3:nested2 -> func:class3:nested2
|
||||
var value_nested2 = nested2.some_value
|
||||
# | | | | ^^^^^^^^^^ -> class3:nested1:some_value
|
||||
# | | ^^^^^^^ -> func:class3:nested2
|
||||
# ^^^^^^^^^^^^^ func:class3:nested2:value
|
||||
var another_value_nested2 = nested2.another_value
|
||||
# | | | | ^^^^^^^^^^^^^ -> class3:nested2:another_value
|
||||
# | | ^^^^^^^ -> func:class3:nested2
|
||||
# ^^^^^^^^^^^^^^^^^^^^^ func:class3:nested2:another_value_nested
|
||||
print(value_nested2, another_value_nested2)
|
||||
# | | ^^^^^^^^^^^^^^^^^^^^^ -> func:class3:nested2:another_value_nested
|
||||
# ^^^^^^^^^^^^^ -> func:class3:nested2:value
|
7
modules/gdscript/tests/scripts/lsp/doc_comments.gd
Normal file
7
modules/gdscript/tests/scripts/lsp/doc_comments.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
## brief
|
||||
##
|
||||
## description
|
||||
##
|
||||
## @tutorial(t1): https://example.com/t2
|
||||
## @tutorial: https://example.com/t3
|
||||
extends Node
|
26
modules/gdscript/tests/scripts/lsp/enums.gd
Normal file
26
modules/gdscript/tests/scripts/lsp/enums.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Node
|
||||
|
||||
enum {UNIT_NEUTRAL, UNIT_ENEMY, UNIT_ALLY}
|
||||
# | | | | ^^^^^^^^^ enum:unnamed:ally -> enum:unnamed:ally
|
||||
# | | ^^^^^^^^^^ enum:unnamed:enemy -> enum:unnamed:enemy
|
||||
# ^^^^^^^^^^^^ enum:unnamed:neutral -> enum:unnamed:neutral
|
||||
enum Named {THING_1, THING_2, ANOTHER_THING = -1}
|
||||
# | | | | | | ^^^^^^^^^^^^^ enum:named:thing3 -> enum:named:thing3
|
||||
# | | | | ^^^^^^^ enum:named:thing2 -> enum:named:thing2
|
||||
# | | ^^^^^^^ enum:named:thing1 -> enum:named:thing1
|
||||
# ^^^^^ enum:named -> enum:named
|
||||
|
||||
func f(arg):
|
||||
match arg:
|
||||
UNIT_ENEMY: print(UNIT_ENEMY)
|
||||
# | ^^^^^^^^^^ -> enum:unnamed:enemy
|
||||
#<^^^^^^^^ -> enum:unnamed:enemy
|
||||
Named.THING_2: print(Named.THING_2)
|
||||
#! | | | | | ^^^^^^^ -> enum:named:thing2
|
||||
# | | | ^^^^^ -> enum:named
|
||||
#! | ^^^^^^^ -> enum:named:thing2
|
||||
#<^^^ -> enum:named
|
||||
_: print(UNIT_ENEMY, Named.ANOTHER_THING)
|
||||
#! | | | | ^^^^^^^^^^^^^ -> enum:named:thing3
|
||||
# | | ^^^^^ -> enum:named
|
||||
# ^^^^^^^^^^ -> enum:unnamed:enemy
|
@@ -0,0 +1,5 @@
|
||||
class_name Test
|
||||
extends Node
|
||||
|
||||
func _init():
|
||||
pass
|
2
modules/gdscript/tests/scripts/lsp/first_line_comment.gd
Normal file
2
modules/gdscript/tests/scripts/lsp/first_line_comment.gd
Normal file
@@ -0,0 +1,2 @@
|
||||
# Some comment
|
||||
extends Node
|
28
modules/gdscript/tests/scripts/lsp/indentation.gd
Normal file
28
modules/gdscript/tests/scripts/lsp/indentation.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends Node
|
||||
|
||||
var root = 0
|
||||
# ^^^^ 0_indent -> 0_indent
|
||||
|
||||
func a():
|
||||
var alpha: int = root + 42
|
||||
# | | ^^^^ -> 0_indent
|
||||
# ^^^^^ 1_indent -> 1_indent
|
||||
if alpha > 42:
|
||||
# ^^^^^ -> 1_indent
|
||||
var beta := alpha + 13
|
||||
# | | ^^^^ -> 1_indent
|
||||
# ^^^^ 2_indent -> 2_indent
|
||||
if beta > alpha:
|
||||
# | | ^^^^^ -> 1_indent
|
||||
# ^^^^ -> 2_indent
|
||||
var gamma = beta + 1
|
||||
# | | ^^^^ -> 2_indent
|
||||
# ^^^^^ 3_indent -> 3_indent
|
||||
print(gamma)
|
||||
# ^^^^^ -> 3_indent
|
||||
print(beta)
|
||||
# ^^^^ -> 2_indent
|
||||
print(alpha)
|
||||
# ^^^^^ -> 1_indent
|
||||
print(root)
|
||||
# ^^^^ -> 0_indent
|
91
modules/gdscript/tests/scripts/lsp/lambdas.gd
Normal file
91
modules/gdscript/tests/scripts/lsp/lambdas.gd
Normal file
@@ -0,0 +1,91 @@
|
||||
extends Node
|
||||
|
||||
var lambda_member1 := func(alpha: int, beta): return alpha + beta
|
||||
# | | | | | | | | ^^^^ -> \1:beta
|
||||
# | | | | | | ^^^^^ -> \1:alpha
|
||||
# | | | | ^^^^ \1:beta -> \1:beta
|
||||
# | | ^^^^^ \1:alpha -> \1:alpha
|
||||
# ^^^^^^^^^^^^^^ \1 -> \1
|
||||
|
||||
var lambda_member2 := func(alpha, beta: int) -> int:
|
||||
# | | | | | |
|
||||
# | | | | | |
|
||||
# | | | | ^^^^ \2:beta -> \2:beta
|
||||
# | | ^^^^^ \2:alpha -> \2:alpha
|
||||
# ^^^^^^^^^^^^^^ \2 -> \2
|
||||
return alpha + beta
|
||||
# | | ^^^^ -> \2:beta
|
||||
# ^^^^^ -> \2:alpha
|
||||
|
||||
var lambda_member3 := func add_values(alpha, beta): return alpha + beta
|
||||
# | | | | | | | | ^^^^ -> \3:beta
|
||||
# | | | | | | ^^^^^ -> \3:alpha
|
||||
# | | | | ^^^^ \3:beta -> \3:beta
|
||||
# | | ^^^^^ \3:alpha -> \3:alpha
|
||||
# ^^^^^^^^^^^^^^ \3 -> \3
|
||||
|
||||
var lambda_multiline = func(alpha: int, beta: int) -> int:
|
||||
# | | | | | |
|
||||
# | | | | | |
|
||||
# | | | | ^^^^ \multi:beta -> \multi:beta
|
||||
# | | ^^^^^ \multi:alpha -> \multi:alpha
|
||||
# ^^^^^^^^^^^^^^^^ \multi -> \multi
|
||||
print(alpha + beta)
|
||||
# | | ^^^^ -> \multi:beta
|
||||
# ^^^^^ -> \multi:alpha
|
||||
var tmp = alpha + beta + 42
|
||||
# | | | | ^^^^ -> \multi:beta
|
||||
# | | ^^^^^ -> \multi:alpha
|
||||
# ^^^ \multi:tmp -> \multi:tmp
|
||||
print(tmp)
|
||||
# ^^^ -> \multi:tmp
|
||||
if tmp > 50:
|
||||
# ^^^ -> \multi:tmp
|
||||
tmp += alpha
|
||||
# | ^^^^^ -> \multi:alpha
|
||||
#<^ -> \multi:tmp
|
||||
else:
|
||||
tmp -= beta
|
||||
# | ^^^^ -> \multi:beta
|
||||
#<^ -> \multi:tmp
|
||||
print(tmp)
|
||||
# ^^^ -> \multi:tmp
|
||||
return beta + tmp + alpha
|
||||
# | | | | ^^^^^ -> \multi:alpha
|
||||
# | | ^^^ -> \multi:tmp
|
||||
# ^^^^ -> \multi:beta
|
||||
|
||||
|
||||
var some_name := "foo bar"
|
||||
# ^^^^^^^^^ member:some_name -> member:some_name
|
||||
|
||||
func _ready() -> void:
|
||||
var a = lambda_member1.call(1,2)
|
||||
# ^^^^^^^^^^^^^^ -> \1
|
||||
var b = lambda_member2.call(1,2)
|
||||
# ^^^^^^^^^^^^^^ -> \2
|
||||
var c = lambda_member3.call(1,2)
|
||||
# ^^^^^^^^^^^^^^ -> \3
|
||||
var d = lambda_multiline.call(1,2)
|
||||
# ^^^^^^^^^^^^^^^^ -> \multi
|
||||
print(a,b,c,d)
|
||||
|
||||
var lambda_local = func(alpha, beta): return alpha + beta
|
||||
# | | | | | | | | ^^^^ -> \local:beta
|
||||
# | | | | | | ^^^^^ -> \local:alpha
|
||||
# | | | | ^^^^ \local:beta -> \local:beta
|
||||
# | | ^^^^^ \local:alpha -> \local:alpha
|
||||
# ^^^^^^^^^^^^ \local -> \local
|
||||
|
||||
var value := 42
|
||||
# ^^^^^ local:value -> local:value
|
||||
var lambda_capture = func(): return value + some_name.length()
|
||||
# | | | | ^^^^^^^^^ -> member:some_name
|
||||
# | | ^^^^^ -> local:value
|
||||
# ^^^^^^^^^^^^^^ \capture -> \capture
|
||||
|
||||
var z = lambda_local.call(1,2)
|
||||
# ^^^^^^^^^^^^ -> \local
|
||||
var x = lambda_capture.call()
|
||||
# ^^^^^^^^^^^^^^ -> \capture
|
||||
print(z,x)
|
25
modules/gdscript/tests/scripts/lsp/local_variables.gd
Normal file
25
modules/gdscript/tests/scripts/lsp/local_variables.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends Node
|
||||
|
||||
var member := 2
|
||||
# ^^^^^^ member -> member
|
||||
|
||||
func test_member() -> void:
|
||||
var test := member + 42
|
||||
# | | ^^^^^^ -> member
|
||||
# ^^^^ test -> test
|
||||
test += 3
|
||||
#<^^ -> test
|
||||
member += 5
|
||||
#<^^^^ -> member
|
||||
test = return_arg(test)
|
||||
# | ^^^^ -> test
|
||||
#<^^ -> test
|
||||
print(test)
|
||||
# ^^^^ -> test
|
||||
|
||||
func return_arg(arg: int) -> int:
|
||||
# ^^^ arg -> arg
|
||||
arg += 2
|
||||
#<^ -> arg
|
||||
return arg
|
||||
# ^^^ -> arg
|
65
modules/gdscript/tests/scripts/lsp/properties.gd
Normal file
65
modules/gdscript/tests/scripts/lsp/properties.gd
Normal file
@@ -0,0 +1,65 @@
|
||||
extends Node
|
||||
|
||||
var prop1 := 42
|
||||
# ^^^^^ prop1 -> prop1
|
||||
var prop2 : int = 42
|
||||
# ^^^^^ prop2 -> prop2
|
||||
var prop3 := 42:
|
||||
# ^^^^^ prop3 -> prop3
|
||||
get:
|
||||
return prop3 + 13
|
||||
# ^^^^^ -> prop3
|
||||
set(value):
|
||||
# ^^^^^ prop3:value -> prop3:value
|
||||
prop3 = value - 13
|
||||
# | ^^^^^ -> prop3:value
|
||||
#<^^^ -> prop3
|
||||
var prop4: int:
|
||||
# ^^^^^ prop4 -> prop4
|
||||
get:
|
||||
return 42
|
||||
var prop5 := 42:
|
||||
# ^^^^^ prop5 -> prop5
|
||||
set(value):
|
||||
# ^^^^^ prop5:value -> prop5:value
|
||||
prop5 = value - 13
|
||||
# | ^^^^^ -> prop5:value
|
||||
#<^^^ -> prop5
|
||||
|
||||
var prop6:
|
||||
# ^^^^^ prop6 -> prop6
|
||||
get = get_prop6,
|
||||
# ^^^^^^^^^ -> get_prop6
|
||||
set = set_prop6
|
||||
# ^^^^^^^^^ -> set_prop6
|
||||
func get_prop6():
|
||||
# ^^^^^^^^^ get_prop6 -> get_prop6
|
||||
return 42
|
||||
func set_prop6(value):
|
||||
# | | ^^^^^ set_prop6:value -> set_prop6:value
|
||||
# ^^^^^^^^^ set_prop6 -> set_prop6
|
||||
print(value)
|
||||
# ^^^^^ -> set_prop6:value
|
||||
|
||||
var prop7:
|
||||
# ^^^^^ prop7 -> prop7
|
||||
get = get_prop7
|
||||
# ^^^^^^^^^ -> get_prop7
|
||||
func get_prop7():
|
||||
# ^^^^^^^^^ get_prop7 -> get_prop7
|
||||
return 42
|
||||
|
||||
var prop8:
|
||||
# ^^^^^ prop8 -> prop8
|
||||
set = set_prop8
|
||||
# ^^^^^^^^^ -> set_prop8
|
||||
func set_prop8(value):
|
||||
# | | ^^^^^ set_prop8:value -> set_prop8:value
|
||||
# ^^^^^^^^^ set_prop8 -> set_prop8
|
||||
print(value)
|
||||
# ^^^^^ -> set_prop8:value
|
||||
|
||||
const const_var := 42
|
||||
# ^^^^^^^^^ const_var -> const_var
|
||||
static var static_var := 42
|
||||
# ^^^^^^^^^^ static_var -> static_var
|
106
modules/gdscript/tests/scripts/lsp/scopes.gd
Normal file
106
modules/gdscript/tests/scripts/lsp/scopes.gd
Normal file
@@ -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
|
56
modules/gdscript/tests/scripts/lsp/shadowing_initializer.gd
Normal file
56
modules/gdscript/tests/scripts/lsp/shadowing_initializer.gd
Normal file
@@ -0,0 +1,56 @@
|
||||
extends Node
|
||||
|
||||
var value := 42
|
||||
# ^^^^^ member:value -> member:value
|
||||
|
||||
func variable():
|
||||
var value = value + 42
|
||||
#! | | ^^^^^ -> member:value
|
||||
# ^^^^^ variable:value -> variable:value
|
||||
print(value)
|
||||
# ^^^^^ -> variable:value
|
||||
|
||||
func array():
|
||||
var value = [1,value,3,value+4]
|
||||
#! | | | | ^^^^^ -> member:value
|
||||
#! | | ^^^^^ -> member:value
|
||||
# ^^^^^ array:value -> array:value
|
||||
print(value)
|
||||
# ^^^^^ -> array:value
|
||||
|
||||
func dictionary():
|
||||
var value = {
|
||||
# ^^^^^ dictionary:value -> dictionary:value
|
||||
"key1": value,
|
||||
#! ^^^^^ -> member:value
|
||||
"key2": 1 + value + 3,
|
||||
#! ^^^^^ -> member:value
|
||||
}
|
||||
print(value)
|
||||
# ^^^^^ -> dictionary:value
|
||||
|
||||
func for_loop():
|
||||
for value in value:
|
||||
# | | ^^^^^ -> member:value
|
||||
# ^^^^^ for:value -> for:value
|
||||
print(value)
|
||||
# ^^^^^ -> for:value
|
||||
|
||||
func for_range():
|
||||
for value in range(5, value):
|
||||
# | | ^^^^^ -> member:value
|
||||
# ^^^^^ for:range:value -> for:range:value
|
||||
print(value)
|
||||
# ^^^^^ -> for:range:value
|
||||
|
||||
func matching():
|
||||
match value:
|
||||
# ^^^^^ -> member:value
|
||||
42: print(value)
|
||||
# ^^^^^ -> member:value
|
||||
[var value, ..]: print(value)
|
||||
# | | ^^^^^ -> match:array:value
|
||||
# ^^^^^ match:array:value -> match:array:value
|
||||
var value: print(value)
|
||||
# | | ^^^^^ -> match:var:value
|
||||
# ^^^^^ match:var:value -> match:var:value
|
16
modules/gdscript/tests/scripts/lsp/super.gd
Normal file
16
modules/gdscript/tests/scripts/lsp/super.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends Node
|
||||
|
||||
class Inner1:
|
||||
# ^^^^^^ class1 -> class1
|
||||
func _init():
|
||||
# ^^^^^ class1:init
|
||||
pass
|
||||
|
||||
class Inner2 extends Inner1:
|
||||
# | | ^^^^^^ -> class1
|
||||
# ^^^^^^ class2 -> class2
|
||||
func _init():
|
||||
# ^^^^^ class2:init
|
||||
super ()
|
||||
# ^^^^^ -> class1:init
|
||||
pass
|
Reference in New Issue
Block a user