Defined Language "if" highlighting within words
-
Example, the word “indifferent” would display as “indifferent”. Format would display as “Format”.
This does not occur with the default languages, like CPP. What do I need to do to my defined language such that “for” and “if” would only highlight as its own whole word, and not as part of a larger word?
-
which version of npp do you use as mine 6.9.2 behaves exactly as you want.
Could it be that you have enabled prefix mode?Cheers
Claudia -
@Claudia-Frank said:
which version of npp do you use as mine 6.9.2 behaves exactly as you want.
Could it be that you have enabled prefix mode?Cheers
Claudia? > About indicates “Notepad++ v7”
I was <Prefix Keywords1=“no” Keywords2=“no” Keywords3=“no” Keywords4=“no” Keywords5=“no” Keywords6=“no” Keywords7=“no” Keywords8=“no” />
I changed it to <Prefix Keywords1=“yes” Keywords2=“yes” Keywords3=“yes” Keywords4=“no” Keywords5=“no” Keywords6=“no” Keywords7=“no” Keywords8=“no” />
The issue still persists. “format” looks like “format”. indifferent still looks like “indifferent”.
format is also a full keyword in keywords1, so it shouldn’t be overrided by “for” which is another keyword in keywords1.
-
here a screenshot of the current 7.1 npp version
and the udl which created the syntax highlighting<NotepadPlus> <UserLang name="test" ext="" udlVersion="2.1"> <Settings> <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" /> <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" /> </Settings> <KeywordLists> <Keywords name="Comments"></Keywords> <Keywords name="Numbers, prefix1"></Keywords> <Keywords name="Numbers, prefix2"></Keywords> <Keywords name="Numbers, extras1"></Keywords> <Keywords name="Numbers, extras2"></Keywords> <Keywords name="Numbers, suffix1"></Keywords> <Keywords name="Numbers, suffix2"></Keywords> <Keywords name="Numbers, range"></Keywords> <Keywords name="Operators1"></Keywords> <Keywords name="Operators2"></Keywords> <Keywords name="Folders in code1, open"></Keywords> <Keywords name="Folders in code1, middle"></Keywords> <Keywords name="Folders in code1, close"></Keywords> <Keywords name="Folders in code2, open"></Keywords> <Keywords name="Folders in code2, middle"></Keywords> <Keywords name="Folders in code2, close"></Keywords> <Keywords name="Folders in comment, open"></Keywords> <Keywords name="Folders in comment, middle"></Keywords> <Keywords name="Folders in comment, close"></Keywords> <Keywords name="Keywords1">format differ</Keywords> <Keywords name="Keywords2">for if</Keywords> <Keywords name="Keywords3"></Keywords> <Keywords name="Keywords4"></Keywords> <Keywords name="Keywords5"></Keywords> <Keywords name="Keywords6"></Keywords> <Keywords name="Keywords7"></Keywords> <Keywords name="Keywords8"></Keywords> <Keywords name="Delimiters"></Keywords> </KeywordLists> <Styles> <WordsStyle name="DEFAULT" fgColor="C8C8C8" bgColor="1E1E1E" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="LINE COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS1" fgColor="FF8000" bgColor="1E1E1E" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS2" fgColor="FFFF00" bgColor="1E1E1E" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> </Styles> </UserLang> </NotepadPlus>
Cheers
Claudia -
I have the exact same problem.
Having “if” defined within
<Keywords name=“Folders in code1, open”>if</Keywords>
makes the string “if” highlight within other words. This is especially annoying if it is within a word that is a keyword and should be highlighted differently. (I had “stiffness” - where the “if” part would be highlighted according to the definition above.From your example screen shot I can see that you do not have anything in:
<Keywords name=“Folders in code1, open”></Keywords>So I tried to not having any “folders in code”, and moved these to be just keywords instead. This worked well, and the highlighting now looks good.
The conclusion is that there is a bug with the highlighting when something is defined as “Folders in code”.
-
see what you mean.
But you could have used folding in code style 2 as well, couldn’t you?Cheers
Claudia -
please shift the folders open & close codes from code1 to code2
e.g.
<Keywords name=“Folders in code1, open”>if for</Keywords>
<Keywords name=“Folders in code1, close”>endif enfor</Keywords>
<Keywords name=“Folders in code2, open”></Keywords>
<Keywords name=“Folders in code2, close”></Keywords>
should be
<Keywords name=“Folders in code1, open”></Keywords>
<Keywords name=“Folders in code1, close”></Keywords>
<Keywords name=“Folders in code2, open”>if for</Keywords>
<Keywords name=“Folders in code2, close”>endif enfor</Keywords>