Skip to content

Commit 7da8d07

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

File tree

3 files changed

+132
-71
lines changed

3 files changed

+132
-71
lines changed

Tests/syntax_test_Class.ps1

+10
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,9 @@ class TypeName
126130
# ^^ variable.other.member
127131
}
128132
}
133+
134+
[TypeName]::MemberMethod1()
135+
# @@@@@@@@@@@@@ reference
136+
137+
$object.MemberMethod2()
138+
# @@@@@@@@@@@@@ reference

Tests/syntax_test_Function.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ using module Microsoft.Management
55
# ^ keyword.other
66
# ^ variable.parameter
77

8+
function Test-Path {}
9+
# @@@@@@@@@ definition
810
<#
911
# <- punctuation.definition.comment.block.begin
1012
.Synopsis
@@ -321,6 +323,7 @@ function Verb-Noun {
321323
# ^ meta.attribute punctuation.section.group.end
322324
# ^ meta.attribute punctuation.section.brackets.end
323325
[ValidateScript({Test-Path $_})] #Make sure cmdlets don't break highlighting
326+
# @@@@@@@@@ reference
324327
# <- meta.attribute punctuation.section.brackets.begin
325328
# ^ meta.attribute support.function.attribute
326329
# ^ meta.attribute punctuation.section.group.begin

Tests/syntax_test_PowerShell.ps1

+119-71
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,65 @@ 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
818-
Invoke-Something -p1 {
819-
# <- support.function
820-
# ^ punctuation.definition.parameter
821-
# ^^^ variable.parameter.option
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
835+
Invoke-Something -p1 {
836+
#^ support.function
837+
#@@@@@@@@@@@@@@@@ reference
838+
# ^ punctuation.definition.parameter
839+
# ^^^ variable.parameter.option
822840
Invoke-Something -foobar:$true
823841
# ^ support.function
842+
# @@@@@@@@@@@@@@@@ reference
824843
# ^ punctuation.definition.parameter
825844
# ^^^^^^^ variable.parameter.option
826845
# ^ punctuation.definition.variable
@@ -829,11 +848,13 @@ Invoke-Something -p1 {
829848
# <- punctuation.section.braces.end
830849
# ^ keyword.operator.logical.pipe
831850
# ^ support.function
832-
Invoke-Something -p1 value `
833-
# <- support.function
834-
# ^ punctuation.definition.parameter
835-
# ^^^ variable.parameter.option
836-
# ^ punctuation.separator.continuation
851+
# @@@@@@@@@@@@@@@@ reference
852+
Invoke-Something -p1 value `
853+
#^ support.function
854+
#@@@@@@@@@@@@@@@@ reference
855+
# ^ punctuation.definition.parameter
856+
# ^^^ variable.parameter.option
857+
# ^ punctuation.separator.continuation
837858
-p2 14.4 `
838859
# ^ punctuation.definition.parameter
839860
# ^^^ variable.parameter.option
@@ -842,6 +863,7 @@ Invoke-Something -p1 value `
842863
-p3 $value | Invoke-Something -verbose
843864
# ^ punctuation.definition.parameter
844865
# ^^^ variable.parameter.option
866+
# @@@@@@@@@@@@@@@@ reference
845867
# ^ punctuation.definition.parameter
846868
# ^^^^^^^^ variable.parameter.option
847869
# ^ punctuation.definition.variable
@@ -1523,19 +1545,29 @@ $b -cLike $c
15231545
# ^ string.quoted.single
15241546
# ^ keyword.operator.string-format
15251547

1548+
function Test-Function {}
1549+
# @@@@@@@@@@@@@ definition
1550+
function New-Object {}
1551+
# @@@@@@@@@@ definition
15261552
# 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
1553+
Test-Function -Class ClassName
1554+
# ^^^^^ - storage.type
1555+
#@@@@@@@@@@@@@ reference
1556+
New-Object -TypeName System.Diagnostics.Process
1557+
# ^^^^^^^ - keyword.control
1558+
#@@@@@@@@@@ reference
1559+
New-Object -TypeName System.Data
1560+
# ^^^^ - keyword.control
1561+
#@@@@@@@@@@ reference
1562+
New-Object -TypeName Sy-stem.if
1563+
# ^^ - keyword.control
1564+
#@@@@@@@@@@ reference
1565+
New-Object -TypeName S_ystem.Clean
15381566
# ^^^^^ - keyword.control
1567+
#@@@@@@@@@@ reference
1568+
New-Object -TypeName Sy_stem-.Throw
1569+
# ^^^^^ - keyword.control
1570+
#@@@@@@@@@@ reference
15391571
echo `"test`"
15401572
# ^^^^^^^^^ - string.quoted
15411573
# ^^ constant.character.escape
@@ -1560,16 +1592,22 @@ echo `"test`"
15601592
# ^ meta.group.array-expression
15611593
# ^ keyword.control
15621594
# ^ meta.block
1595+
function join-path {}
1596+
# @@@@@@@@@ definition
15631597
$file = join-path $env:SystemDrive "$([System.io.path]::GetRandomFileName()).ps1"
15641598
# <- punctuation.definition.variable
1599+
# @@@@@@@@@ reference
15651600
# ^ support.function
15661601
# ^ support.variable.drive
15671602
# ^ variable.other.readwrite
15681603
# ^^ meta.string meta.interpolation punctuation.section.interpolation.begin
15691604
# ^ storage.type
15701605
# @@@@@@@@@@@@@@@@@ reference
1606+
function out-file {}
1607+
# @@@@@@@@ definition
15711608
$ScriptBlock | Out-File $file -Force
15721609
# <- punctuation.definition.variable
1610+
# @@@@@@@@ reference
15731611
# ^ keyword.operator.logical.pipe
15741612
# ^ punctuation.definition.variable
15751613
# ^ punctuation.definition.parameter
@@ -1589,15 +1627,21 @@ Workflow work { sequence {} }
15891627
# ^ punctuation.section.braces.begin
15901628
# ^ punctuation.section.braces.end
15911629
# ^ 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
1630+
function get-something {}
1631+
# @@@@@@@@@@@@@ definition
1632+
function Out-WithYou {}
1633+
# @@@@@@@@@@@ definition
1634+
get-thing | Out-WithYou > $null # destroy
1635+
#^^^^^^^^^ support.function
1636+
#@@@@@@@@@ reference
1637+
# ^^^^^^^^^^^ support.function
1638+
# @@@@@@@@@@@ reference
1639+
# ^ keyword.operator.logical.pipe
1640+
# ^ keyword.operator.redirection
1641+
# ^ punctuation.definition.variable
1642+
# ^ constant.language
1643+
# ^ punctuation.definition.comment
1644+
# ^^^^^^^^^ comment.line
16011645
"Escaped chars: `", `n, `$, `b, `t, `e, `u{10ffff}, `""
16021646
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
16031647
# ^^ constant.character.escape
@@ -1611,8 +1655,12 @@ get-thing | Out-WithYou > $null # destroy
16111655
'But here they''re not escape chars: `", `n, `$, `b, `"'
16121656
# ^^ constant.character.escape
16131657
# ^^^^^^^^^^^^^^^^^^^ - constant
1658+
function get-number {}
1659+
# @@@@@@@@@@ definition
16141660
"When you call a method: $( get-number | %{ invoke-command $( [string]::format("Like (this{0})","what?") ) $var } )"
16151661
# ^^ punctuation.section.interpolation.begin - source.powershell.embedded
1662+
# @@@@@@@@@@ reference
1663+
# @@@@@@@@@@@@@@ reference
16161664
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.powershell.embedded
16171665
# ^ keyword.operator.logical.pipe
16181666
# ^ meta.group.complex.subexpression punctuation.section.group.begin

0 commit comments

Comments
 (0)