diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index cad1da0..425ca1f 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -63,7 +63,7 @@ include - #interpolatedStringContent + #subexpression include @@ -239,15 +239,20 @@ begin - (\$)(\() + ((\$))(\() beginCaptures 1 name - punctuation.definition.variable.powershell + keyword.other.substatement.powershell 2 + + name + punctuation.definition.subexpression.powershell + + 3 name punctuation.section.group.begin.powershell @@ -689,7 +694,7 @@ - interpolatedStringContent + subexpression begin \( @@ -701,8 +706,6 @@ punctuation.section.group.begin.powershell - contentName - interpolated.simple.source.powershell end \) endCaptures @@ -713,43 +716,52 @@ punctuation.section.group.end.powershell + name + meta.group.simple.subexpression.powershell patterns include $self - - include - #interpolation - - - include - #interpolatedStringContent - interpolation begin - (\$)(\() + (((\$)))((\()) beginCaptures 1 name - punctuation.definition.variable.powershell + keyword.other.substatement.powershell 2 + + name + punctuation.definition.substatement.powershell + + 3 + + name + punctuation.section.embedded.substatement.begin.powershell + + 4 name punctuation.section.group.begin.powershell + 5 + + name + punctuation.section.embedded.substatement.begin.powershell + contentName interpolated.complex.source.powershell end - \) + (\)) endCaptures 0 @@ -757,21 +769,20 @@ name punctuation.section.group.end.powershell + 1 + + name + punctuation.section.embedded.substatement.end.powershell + + name + meta.embedded.substatement.powershell patterns include $self - - include - #interpolation - - - include - #interpolatedStringContent - numericConstant diff --git a/spec/testfiles/syntax_test_TheBigTestFile.ps1 b/spec/testfiles/syntax_test_TheBigTestFile.ps1 index 42b7350..9705abe 100644 --- a/spec/testfiles/syntax_test_TheBigTestFile.ps1 +++ b/spec/testfiles/syntax_test_TheBigTestFile.ps1 @@ -153,7 +153,11 @@ $variable.Name "This is my $($variable.Name)!" # <- punctuation.definition.string.begin.powershell string.quoted.double.powershell # ^^^^^^^^^^ ^^ string.quoted.double.powershell -# ^ ^ punctuation.definition.variable.powershell +# ^^ punctuation.section.embedded.substatement.begin.powershell +# ^ punctuation.section.embedded.substatement.end.powershell +# ^^^^^^^^^^^^^^^^^ meta.embedded.substatement.powershell +# ^ keyword.other.substatement.powershell +# ^ punctuation.definition.variable.powershell # ^ punctuation.section.group.begin.powershell # ^ punctuation.section.group.end.powershell # ^^^^^^^^ variable.other.readwrite.powershell @@ -372,7 +376,10 @@ $a3[1..2] # ^^^^^^^^^^^^ string.quoted.double.powershell "$(Invoke-Something)" # ^ ^ string.quoted.double.powershell -# ^ punctuation.definition.variable.powershell +# ^^ punctuation.section.embedded.substatement.begin.powershell +# ^ punctuation.section.embedded.substatement.end.powershell +# ^^^^^^^^^^^^^^^^^^^ meta.embedded.substatement.powershell +# ^ keyword.other.substatement.powershell # ^ punctuation.section.group.begin.powershell # ^ interpolated.complex.source.powershell support.function.powershell # ^ punctuation.section.group.end.powershell @@ -1204,7 +1211,7 @@ $file = join-path $env:SystemDrive "$([System.io.path]::GetRandomFileName()).ps1 # ^ support.function.powershell # ^ support.variable.drive.powershell # ^ variable.other.readwrite.powershell -# ^ string.quoted.double.powershell punctuation.definition.variable.powershell +# ^ string.quoted.double.powershell punctuation.definition.substatement.powershell punctuation.section.embedded.substatement.begin.powershell # ^ storage.type.powershell $ScriptBlock | Out-File $file -Force # <- punctuation.definition.variable.powershell @@ -1238,7 +1245,8 @@ get-thing | Out-WithYou > $null # destroy # ^^ constant.character.escape.powershell # ^^ ^^ ^^ ^^ ^^ not:constant.character.escape.powershell "When you call a method: $( get-number | %{ invoke-command $( [string]::format("Like (this{0})","what?") ) $var } )" -# ^ ^ punctuation.definition.variable.powershell +# ^ string.quoted.double.powershell punctuation.definition.substatement.powershell punctuation.section.embedded.substatement.begin.powershell +# ^ punctuation.definition.variable.powershell # ^ keyword.operator.other.powershell # ^ ^ meta.group.complex.subexpression.powershell punctuation.section.group.begin.powershell # ^ storage.type.powershell