From 3986f90b58b88547338900464522bffba7085ce8 Mon Sep 17 00:00:00 2001 From: Michael Lyons Date: Thu, 18 Jun 2026 15:00:13 -0400 Subject: [PATCH] Fix unquoted strings leaking into quotes Fixes #228 --- PowerShell.sublime-syntax | 4 ++-- tests/syntax_test_strings.ps1 | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/PowerShell.sublime-syntax b/PowerShell.sublime-syntax index 6a467c8..b9680ab 100644 --- a/PowerShell.sublime-syntax +++ b/PowerShell.sublime-syntax @@ -339,8 +339,8 @@ contexts: inside-unquoted-string: - meta_include_prototype: false - - meta_scope: string.unquoted.powershell - - match: $|(?=[\s#|>;,()}]) + - meta_scope: meta.string.powershell string.unquoted.powershell + - match: $|(?=[\s#|>;,()}"']) pop: 1 - match: \{ push: inside-unquoted-string-brace diff --git a/tests/syntax_test_strings.ps1 b/tests/syntax_test_strings.ps1 index 1ff74be..f58b6bc 100644 --- a/tests/syntax_test_strings.ps1 +++ b/tests/syntax_test_strings.ps1 @@ -794,3 +794,11 @@ # ^ punctuation.definition.keyword.powershell # ^^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell # ^ punctuation.separator.decimal.powershell + +###[ Real Samples ]############################################################ + + git -c http.extraheader="AUTHORIZATION: Basic $base64Pat" pull origin main-vs-deps +# @@@ reference +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string +# ^^^^^^^^^^^^^^^^^ string.unquoted +# ^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double