Skip to content

Commit 7632d7d

Browse files
authored
Add support for long options in syntax (#192)
* Add support for long options in syntax Tweak the regex which matches command options to correctly detect GNU-style long options. * Add support for '+' options These options are used in programs like ImageMagick.
1 parent a0ceb7f commit 7632d7d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

PowerShell.sublime-syntax

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ contexts:
186186
captures:
187187
1: punctuation.definition.keyword.powershell
188188
# Flags/Options/Parameters
189-
- match: \B([-/])\p{L}(?:[\w-]*\w)?
189+
- match: \B(--?|[/+])\p{L}(?:[\w-]*\w)?
190190
scope: variable.parameter.option.powershell
191191
captures:
192192
1: punctuation.definition.parameter.powershell

Tests/syntax_test_PowerShell.ps1

+11
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ throw "Do not run this file!"
9292
# ^^^ keyword.control
9393
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted - constant - variable - comment
9494

95+
& gnutool.exe -s 'short option' --long-option --very_long_option value +plus-option
96+
#<- keyword.operator.other
97+
# ^^^^^^^^^^^ variable.function
98+
# ^ variable.parameter.option punctuation.definition.parameter
99+
# ^ variable.parameter.option
100+
# ^^ variable.parameter.option punctuation.definition.parameter
101+
# ^^ variable.parameter.option punctuation.definition.parameter
102+
# ^^^^^^^^^^^^^^^^ variable.parameter.option
103+
# ^ variable.parameter.option punctuation.definition.parameter
104+
# ^^^^^^^^^^^ variable.parameter.option
105+
95106
# Automatic variables
96107
$_, $$, $^, $?
97108
# <- punctuation.definition.variable

0 commit comments

Comments
 (0)