@ljhmily said in settings--preference--language style setting--bash--instruction word,is the keywords has number or word limit?:
i added some keywords, like su wget api ssh, but only su wget ssh worked, the api and others not.
su and wget are already keywords (INSTRUCTION WORD), so you don’t need to add them.
And when I add api ssh to the list, they immediately start highlighting:
But, as @Terry-R said,
further test seems to show only the word against the margin will highlight if amongst the user added words
It’s more nuanced than that, as shown by my screenshot:
d5b9e1be-2492-4aca-a09c-f6d917a84620-image.png
cat api only marks cat as a keyword because in the grammar of bash, cat is in the location of a command, but api is not (it’s the argument, not the instruction). But api blah at the beginning of the line will allow api to be recognized as an INSTRUCTION WORD, because it is grammatically where an instruction should be. Further, on my examples with | pipes and & or ; separators, the first word after the separator can also be recognized as an INSTRUCTION WORD, too… because they are instructions.
You might try to argue that something like
edec2c4f-2917-4462-b8a3-0e881bd569c9-image.png
should highlight the ls as well as the ssh, because ls is also a command… but really, it’s not a command in terms of the bash script running on the local machine – it’s only a command once it’s sent all the way to the remote connection.
similarly, ansible -vv api -m copy has -vv, api, -m, and copy as arguments, not as instructions, so only the ansible is a potential instruction word… and since it’s not a builtin keyword nor in my list of user-defined keywords, it is not highlighted.
So, personally, I consider the bash/unix-shell syntax highlighter to be working correctly; according to the grammar that’s built into the lexer, it is highlighting the builtin or user-defined keywords when they are grammatically being used as instruction words, and only then. If you consider that a bug (I do not), this forum is not the right place to report it; in fact, the Notepad++ project is even the wrong place to report it, because the bash lexer is defined/coded in the Scintilla project which Notepad++ uses for that feature. You would have to go report that bug to Scintilla; once/if they fix it, you would then have to ask Notepad++ to upgrade to the newer Scintilla.
However, you can add extra highlighting to a builtin lexer (like the bash/unix-shell lexer) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo. Those regexes wouldn’t be limited by the bash/unix-shell grammatical constraints, so if you defined a regex like \b(api|ssh|ansible)\b, it would highlight those words under the scripts color definitions whenever they were found, not just in grammatically instruction-word locations.