Skip to content

Commit

Permalink
Scope +o options
Browse files Browse the repository at this point in the history
Fixes #8.

Speculatively scoping "+opt" as option too, not only "+o". If there's an
issue with this later on, we can always make this stricter.
  • Loading branch information
victor-gp committed Nov 6, 2022
1 parent 25d02fa commit 61a7a98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions syntaxes/cmd-help.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ contexts:
- match: '{{allcaps_argument_name}}(:{{allcaps_argument_name}})*'
scope: *OPTION_ARGUMENT_SCOPES
set: then-pop
# e.g.: "+s, --no-sort" (from fzf)
- match: '[a-z]+'
scope: *OPTION_DEF_SCOPES
set: option-def-post
- include: else-pop

### other definitions ########################################################
Expand Down
4 changes: 2 additions & 2 deletions tests/highlighted/fzf-0.33.0.txt

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

9 changes: 3 additions & 6 deletions tests/syntax/syntax_test_fzf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ usage: fzf [options]
-e, --exact Enable Exact-match
-i Case-insensitive match (default: smart-case match)
+i Case-sensitive match
# ^ entity.name.function.option.cmd-help
# ^ - entity.name.function.option.cmd-help
#todo #8: scope +options
# ^^ entity.name.function.option.cmd-help
--scheme=SCHEME Scoring scheme [default|path|history]
--literal Do not normalize latin script letters before matching
-n, --nth=N[,..] Comma-separated list of field index expressions
Expand All @@ -20,10 +18,9 @@ usage: fzf [options]
field index expressions
-d, --delimiter=STR Field delimiter regex (default: AWK-style)
+s, --no-sort Do not sort the result
# ^ entity.name.function.option.cmd-help
# ^ - entity.name.function.option.cmd-help
# ^^ entity.name.function.option.cmd-help
# ^^ - entity.name.function.option.cmd-help
# ^^^^^^^^^ - entity.name.function.option.cmd-help
# ^^^^^^^^^ entity.name.function.option.cmd-help
--tac Reverse the order of the input
--disabled Do not perform search
--tiebreak=CRI[,..] Comma-separated list of sort criteria to apply
Expand Down

0 comments on commit 61a7a98

Please sign in to comment.