Skip to content

Commit 3879886

Browse files
committed
Add dummy function definitions and references to make symbol tests pass
1 parent 6b87cb5 commit 3879886

File tree

2 files changed

+125
-67
lines changed

2 files changed

+125
-67
lines changed

Tests/syntax_test_Class.ps1

+11
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class TypeName
8080
# ^ punctuation.section.brackets.begin
8181
# ^^^^ storage.type
8282
# ^ punctuation.section.brackets.end
83+
# ^^^^^^^^^^^^^ entity.name.function
84+
# @@@@@@@@@@@@@ definition
8385
# ^ punctuation.section.group.begin
8486
# ^ punctuation.section.brackets.begin
8587
# ^^^^^^^^^ storage.type
@@ -105,6 +107,8 @@ class TypeName
105107
# <- punctuation.section.brackets.begin
106108
# ^ storage.type
107109
# ^ punctuation.section.brackets.end
110+
# ^^^^^^^^^^^^^ entity.name.function
111+
# @@@@@@@@@@@@@ definition
108112
# ^ punctuation.section.group.begin
109113
# ^ punctuation.section.brackets.begin
110114
# ^^^ storage.type
@@ -126,3 +130,10 @@ class TypeName
126130
# ^^ variable.other.member
127131
}
128132
}
133+
134+
[TypeName]::MemberMethod1()
135+
# @@@@@@@@@@@@@ reference
136+
137+
$object = [TypeName]::new()
138+
$object.MemberMethod2()
139+
# @@@@@@@@@@@@@ reference

Tests/syntax_test_PowerShell.ps1

+114-67
Original file line numberDiff line numberDiff line change
@@ -262,23 +262,29 @@ $properties = @{
262262
}
263263
# <- punctuation.section.braces.end
264264

265+
function Invoke-Something {}
266+
# @@@@@@@@@@@@@@@@ definition
267+
265268
# Spatting
266269
Invoke-Something @properties
267270
# ^^^^^^^^^^^^^^^^ support.function
271+
# @@@@@@@@@@@@@@@@ reference
268272
# ^ punctuation.definition.variable
269273
# ^ variable.other.readwrite
270274

271275
# ScriptBlock
272276
{Invoke-Something @properties}
273277
# ^ punctuation.section.braces.begin
274278
# ^^^^^^^^^^^^^^^^ support.function
279+
# @@@@@@@@@@@@@@@@ reference
275280
# ^ punctuation.definition.variable
276281
# ^ variable.other.readwrite
277282
# ^ punctuation.section.braces.end
278283
{
279284
# <- punctuation.section.braces.begin
280285
Invoke-Something @properties
281286
# ^^^^^^^^^^^^^^^^ support.function
287+
# @@@@@@@@@@@@@@@@ reference
282288
# ^ punctuation.definition.variable
283289
# ^ variable.other.readwrite
284290
}
@@ -290,6 +296,7 @@ $sb = {
290296
# ^ punctuation.section.braces.begin
291297
Invoke-Something @properties
292298
# ^^^^^^^^^^^^^^^^ support.function
299+
# @@@@@@@@@@@@@@@@ reference
293300
# ^ punctuation.definition.variable
294301
# ^ variable.other.readwrite
295302
}
@@ -445,6 +452,7 @@ $a3[1..2]
445452
# ^^ punctuation.section.interpolation.begin
446453
# ^^^^^^^^^^^^^^^^ support.function
447454
# ^ punctuation.section.interpolation.end
455+
# @@@@@@@@@@@@@@@@ reference
448456
"This 'string' is nice."
449457
# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double
450458

@@ -773,54 +781,64 @@ There is no @platting here!
773781
# ^ punctuation.section.arguments.end
774782

775783
# Commands (functions)
776-
Invoke-Something -foobar
777-
# <- support.function
778-
# ^ punctuation.definition.parameter
779-
# ^^^^^^^ variable.parameter.option
780-
Invoke-Something -foobar value
781-
# <- support.function
782-
# ^ punctuation.definition.parameter
783-
# ^^^^^^^ variable.parameter.option
784-
Invoke-Something -foobar:$true
785-
# <- support.function
786-
# ^ punctuation.definition.parameter
787-
# ^^^^^^^ variable.parameter.option
788-
# ^ punctuation.definition.variable
789-
# ^^^^ constant.language
790-
Invoke-Something -foobar: $true
791-
# <- support.function
792-
# ^ punctuation.definition.parameter
793-
# ^^^^^^^ variable.parameter.option
794-
Invoke-Something -p1 v1 -p2 10 -p3 'value' -switch -verbose
795-
# <- support.function
796-
# ^ punctuation.definition.parameter
797-
# ^^^ variable.parameter.option
798-
# ^ punctuation.definition.parameter
799-
# ^^^ variable.parameter.option
800-
# ^^ meta.number.integer.decimal constant.numeric.value
801-
# ^^^^^^ - keyword
802-
# ^ punctuation.definition.parameter
803-
# ^^^ variable.parameter.option
804-
Invoke-Something (1..20 | Invoke-Something) -p2 'value'
805-
# <- support.function
806-
# ^^ keyword.operator.range
807-
Invoke-Something -p1 v2 -p2 30 | Invoke-Something -switch
808-
# <- support.function
809-
# ^ punctuation.definition.parameter
810-
# ^^^ variable.parameter.option
811-
# ^ punctuation.definition.parameter
812-
# ^^^ variable.parameter.option
813-
# ^^ meta.number.integer.decimal constant.numeric.value
814-
# ^ keyword.operator.logical.pipe
815-
# ^ support.function
816-
# ^ punctuation.definition.parameter
817-
# ^^^^^^^ variable.parameter.option - keyword
784+
Invoke-Something -foobar
785+
#^ support.function
786+
# ^ punctuation.definition.parameter
787+
# ^^^^^^^ variable.parameter.option
788+
#@@@@@@@@@@@@@@@@ reference
789+
Invoke-Something -foobar value
790+
#^ support.function
791+
# ^ punctuation.definition.parameter
792+
# ^^^^^^^ variable.parameter.option
793+
#@@@@@@@@@@@@@@@@ reference
794+
Invoke-Something -foobar:$true
795+
#^ support.function
796+
#@@@@@@@@@@@@@@@@ reference
797+
# ^ punctuation.definition.parameter
798+
# ^^^^^^^ variable.parameter.option
799+
# ^ punctuation.definition.variable
800+
# ^^^^ constant.language
801+
Invoke-Something -foobar: $true
802+
#^ support.function
803+
#@@@@@@@@@@@@@@@@ reference
804+
# ^ punctuation.definition.parameter
805+
# ^^^^^^^ variable.parameter.option
806+
Invoke-Something -p1 v1 -p2 10 -p3 'value' -switch -verbose
807+
#^ support.function
808+
#@@@@@@@@@@@@@@@@ reference
809+
# ^ punctuation.definition.parameter
810+
# ^^^ variable.parameter.option
811+
# ^ punctuation.definition.parameter
812+
# ^^^ variable.parameter.option
813+
# ^^ meta.number.integer.decimal constant.numeric.value
814+
# ^^^^^^ - keyword
815+
# ^ punctuation.definition.parameter
816+
# ^^^ variable.parameter.option
817+
Invoke-Something (1..20 | Invoke-Something) -p2 'value'
818+
#^ support.function
819+
#@@@@@@@@@@@@@@@@ reference
820+
# @@@@@@@@@@@@@@@@ reference
821+
# ^^ keyword.operator.range
822+
Invoke-Something -p1 v2 -p2 30 | Invoke-Something -switch
823+
#^ support.function
824+
# @@@@@@@@@@@@@@@@ reference
825+
#@@@@@@@@@@@@@@@@ reference
826+
# ^ punctuation.definition.parameter
827+
# ^^^ variable.parameter.option
828+
# ^ punctuation.definition.parameter
829+
# ^^^ variable.parameter.option
830+
# ^^ meta.number.integer.decimal constant.numeric.value
831+
# ^ keyword.operator.logical.pipe
832+
# ^ support.function
833+
# ^ punctuation.definition.parameter
834+
# ^^^^^^^ variable.parameter.option - keyword
818835
Invoke-Something -p1 {
819836
# <- support.function
820837
# ^ punctuation.definition.parameter
821838
# ^^^ variable.parameter.option
822839
Invoke-Something -foobar:$true
823840
# ^ support.function
841+
# @@@@@@@@@@@@@@@@ reference
824842
# ^ punctuation.definition.parameter
825843
# ^^^^^^^ variable.parameter.option
826844
# ^ punctuation.definition.variable
@@ -829,11 +847,13 @@ Invoke-Something -p1 {
829847
# <- punctuation.section.braces.end
830848
# ^ keyword.operator.logical.pipe
831849
# ^ support.function
832-
Invoke-Something -p1 value `
833-
# <- support.function
834-
# ^ punctuation.definition.parameter
835-
# ^^^ variable.parameter.option
836-
# ^ punctuation.separator.continuation
850+
# @@@@@@@@@@@@@@@@ reference
851+
Invoke-Something -p1 value `
852+
#^ support.function
853+
#@@@@@@@@@@@@@@@@ reference
854+
# ^ punctuation.definition.parameter
855+
# ^^^ variable.parameter.option
856+
# ^ punctuation.separator.continuation
837857
-p2 14.4 `
838858
# ^ punctuation.definition.parameter
839859
# ^^^ variable.parameter.option
@@ -842,6 +862,7 @@ Invoke-Something -p1 value `
842862
-p3 $value | Invoke-Something -verbose
843863
# ^ punctuation.definition.parameter
844864
# ^^^ variable.parameter.option
865+
# @@@@@@@@@@@@@@@@ reference
845866
# ^ punctuation.definition.parameter
846867
# ^^^^^^^^ variable.parameter.option
847868
# ^ punctuation.definition.variable
@@ -1523,19 +1544,29 @@ $b -cLike $c
15231544
# ^ string.quoted.single
15241545
# ^ keyword.operator.string-format
15251546

1547+
function Test-Function {}
1548+
# @@@@@@@@@@@@@ definition
1549+
function New-Object {}
1550+
# @@@@@@@@@@ definition
15261551
# Misc test cases
1527-
Test-Function -Class ClassName
1528-
# ^^^^^ - storage.type
1529-
New-Object -TypeName System.Diagnostics.Process
1530-
# ^^^^^^^ - keyword.control
1531-
New-Object -TypeName System.Data
1532-
# ^^^^ - keyword.control
1533-
New-Object -TypeName Sy-stem.if
1534-
# ^^ - keyword.control
1535-
New-Object -TypeName S_ystem.Clean
1536-
# ^^^^^ - keyword.control
1537-
New-Object -TypeName Sy_stem-.Throw
1552+
Test-Function -Class ClassName
1553+
# ^^^^^ - storage.type
1554+
#@@@@@@@@@@@@@ reference
1555+
New-Object -TypeName System.Diagnostics.Process
1556+
# ^^^^^^^ - keyword.control
1557+
#@@@@@@@@@@ reference
1558+
New-Object -TypeName System.Data
1559+
# ^^^^ - keyword.control
1560+
#@@@@@@@@@@ reference
1561+
New-Object -TypeName Sy-stem.if
1562+
# ^^ - keyword.control
1563+
#@@@@@@@@@@ reference
1564+
New-Object -TypeName S_ystem.Clean
15381565
# ^^^^^ - keyword.control
1566+
#@@@@@@@@@@ reference
1567+
New-Object -TypeName Sy_stem-.Throw
1568+
# ^^^^^ - keyword.control
1569+
#@@@@@@@@@@ reference
15391570
echo `"test`"
15401571
# ^^^^^^^^^ - string.quoted
15411572
# ^^ constant.character.escape
@@ -1560,16 +1591,22 @@ echo `"test`"
15601591
# ^ meta.group.array-expression
15611592
# ^ keyword.control
15621593
# ^ meta.block
1594+
function join-path {}
1595+
# @@@@@@@@@ definition
15631596
$file = join-path $env:SystemDrive "$([System.io.path]::GetRandomFileName()).ps1"
15641597
# <- punctuation.definition.variable
1598+
# @@@@@@@@@ reference
15651599
# ^ support.function
15661600
# ^ support.variable.drive
15671601
# ^ variable.other.readwrite
15681602
# ^^ meta.string meta.interpolation punctuation.section.interpolation.begin
15691603
# ^ storage.type
15701604
# @@@@@@@@@@@@@@@@@ reference
1605+
function out-file {}
1606+
# @@@@@@@@ definition
15711607
$ScriptBlock | Out-File $file -Force
15721608
# <- punctuation.definition.variable
1609+
# @@@@@@@@ reference
15731610
# ^ keyword.operator.logical.pipe
15741611
# ^ punctuation.definition.variable
15751612
# ^ punctuation.definition.parameter
@@ -1589,15 +1626,21 @@ Workflow work { sequence {} }
15891626
# ^ punctuation.section.braces.begin
15901627
# ^ punctuation.section.braces.end
15911628
# ^ punctuation.section.braces.end
1592-
get-thing | Out-WithYou > $null # destroy
1593-
# ^^^^^^^ support.function
1594-
# ^^^^^^^^^^^ support.function
1595-
# ^ keyword.operator.logical.pipe
1596-
# ^ keyword.operator.redirection
1597-
# ^ punctuation.definition.variable
1598-
# ^ constant.language
1599-
# ^ punctuation.definition.comment
1600-
# ^^^^^^^^^ comment.line
1629+
function get-something {}
1630+
# @@@@@@@@@@@@@ definition
1631+
function Out-WithYou {}
1632+
# @@@@@@@@@@@ definition
1633+
get-thing | Out-WithYou > $null # destroy
1634+
#^^^^^^^^^ support.function
1635+
#@@@@@@@@@ reference
1636+
# ^^^^^^^^^^^ support.function
1637+
# @@@@@@@@@@@ reference
1638+
# ^ keyword.operator.logical.pipe
1639+
# ^ keyword.operator.redirection
1640+
# ^ punctuation.definition.variable
1641+
# ^ constant.language
1642+
# ^ punctuation.definition.comment
1643+
# ^^^^^^^^^ comment.line
16011644
"Escaped chars: `", `n, `$, `b, `t, `e, `u{10ffff}, `""
16021645
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
16031646
# ^^ constant.character.escape
@@ -1611,8 +1654,12 @@ get-thing | Out-WithYou > $null # destroy
16111654
'But here they''re not escape chars: `", `n, `$, `b, `"'
16121655
# ^^ constant.character.escape
16131656
# ^^^^^^^^^^^^^^^^^^^ - constant
1657+
function get-number {}
1658+
# @@@@@@@@@@ definition
16141659
"When you call a method: $( get-number | %{ invoke-command $( [string]::format("Like (this{0})","what?") ) $var } )"
16151660
# ^^ punctuation.section.interpolation.begin - source.powershell.embedded
1661+
# @@@@@@@@@@ reference
1662+
# @@@@@@@@@@@@@@ reference
16161663
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.powershell.embedded
16171664
# ^ keyword.operator.logical.pipe
16181665
# ^ meta.group.complex.subexpression punctuation.section.group.begin

0 commit comments

Comments
 (0)