Skip to content

Commit

Permalink
Handle on/off segments in options
Browse files Browse the repository at this point in the history
With the help message samples we have, these are always like
--[no-]option

On the fence about leaving the square brackets un-scoped (so no
particular color, just default fg).
  • Loading branch information
victor-gp committed Dec 28, 2023
1 parent e3b4620 commit 59252f7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 6 additions & 0 deletions syntaxes/cmd-help.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,17 @@ contexts:
- include: option-term

option-term:
- include: option-term-optional-bits
- match: -{{option_name}}
scope: *OPTION_SCOPES
set: option-term-post
- include: rails-long-options

option-term-optional-bits:
- match: -{{option_name}}\[{{option_name}}-\]{{option_name}}
scope: *OPTION_SCOPES
set: option-term-post

option-def-specials:
- match: --(?=\s)
scope: *END_OF_OPTIONS_SCOPE
Expand Down
2 changes: 1 addition & 1 deletion tests/highlighted/dpkg-1.19.7.txt

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

12 changes: 6 additions & 6 deletions tests/highlighted/rubocop-1.25.1.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_rubocop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ Basic Options:
-s, --stdin FILE Pipe source from STDIN, using FILE in offense
reports. This is useful for editor integration.
-P, --[no-]parallel Use available CPUs to execute inspection in
# ^^^^^^^^ - entity.name.function.option.cmd-help
#todo: handle on/off segments in options
# ^^^^^^^^^^^^^^^ entity.name.function.option.cmd-help
parallel. Default is true.
--fail-level SEVERITY Minimum severity (A/I/R/C/W/E/F) for exit
with error code.
Expand Down

0 comments on commit 59252f7

Please sign in to comment.