-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(bash) Less false positives for keywords in arguments (#2669)
In bash, option, param, and command names may contain builtins as hyphen-delimited components. As in `foo --set-bar`. (where `set` is a keyword and therefore incorrectly highlighted) In order to handle this, just add `-` to the pattern's set of word characters. Includes a new test for bash tokens containing keywords, which checks hyphens and underscores for a few common cases.
- Loading branch information
Showing
4 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<span class="hljs-comment"># a keyword as part of an option</span> | ||
mycmd --disable-foo | ||
|
||
<span class="hljs-comment"># a keyword as part of a parameter</span> | ||
some-cmd set-some-setting | ||
some-cmd set_some_setting | ||
|
||
<span class="hljs-comment"># a keyword as part of command</span> | ||
check-case foo | ||
check_case foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# a keyword as part of an option | ||
mycmd --disable-foo | ||
|
||
# a keyword as part of a parameter | ||
some-cmd set-some-setting | ||
some-cmd set_some_setting | ||
|
||
# a keyword as part of command | ||
check-case foo | ||
check_case foo |