Skip to content

Commit

Permalink
Accept option alternatives after "," + 3 spaces
Browse files Browse the repository at this point in the history
Fixes #25

Kind of related to the solution to #22. There, we accepted 2 spaces
instead of the most common single space: ", ". This allows for a 3rd
space.

Some help messages do this to align short and long options, and it
doesn't seem to give any false positives, so let's allow it.
  • Loading branch information
victor-gp committed Dec 22, 2023
1 parent a85a180 commit 01431fb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion syntaxes/cmd-help.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ contexts:
set: option-def-alt
- match: '\s+(?=-)'
set: option-def-alt
- match: ', (?=\S)'
- match: ', {2,3}(?=\S)'
set: option-def-alt

option-def-alt:
Expand Down
48 changes: 24 additions & 24 deletions tests/highlighted/nvidia-smi-470.129.06.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions tests/syntax/syntax_test_nvidia-smi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ nvidia-smi [OPTION1 [ARG1]] [OPTION2 [ARG2]] ...
-h, --help Print usage information and exit.
# ^^ entity.name.function.option.cmd-help
# ^^^ - entity.name.function.option.cmd-help
# ^^^^^^ - entity.name.function.option.cmd-help
#todo: #25
# ^^^^^^ entity.name.function.option.cmd-help

LIST OPTIONS:

Expand Down

0 comments on commit 01431fb

Please sign in to comment.