UDL comment entries.
-
I cannot tell from your description what you are trying to do, or what sequence of events you’ve tried.
It’s really much easier to define your UDL with Language > User Defined Language > Define your language then trying to mess around with the UDL XML, unless you really know what you’re doing with the XML. There isn’t anything about the UDL that you can define in the XML that isn’t doable from the graphical environment.
But, in general, if you are editing Notepad++ config files in Notepad++, then the sequence of events you should follow is listed in the user manual. (And when you are editing configurations through the menus/dialogs, the changes won’t necessarily show up in the configuration XML files until you’ve exited Notepad++, because it writes its updated configuration on exit.)
-
@pasha-19
Neither of the following have been tested sufficiently because I have not gotten stable comment detection yet. Therefore these comments were added to indicate my previously mentioned and not described issues.I made reference to partially working comments. Comments are recognized at the start of a line or sometimes intented on a line. Some comments start with multiple ###'s they are only detected after placing a space after the first # then it can be removed and the comment remains detected until the next time the file is opened again. I can adjust if #(space) is required.
A second issue is if a comment follows an actual statement or portion thereof. I was adding #case# #cond# and #esac# hopefully to fold a case statement using comment folding. The comments are not recognized if actually placed after the appropriate portions of the case statement. They were recognized on separate lines before of after the appropriate part of the case statement. However, no folding indications were achieved. I am not satisfied I have thoroughly tested these items yet
I also get strange folding indicators over the incorrect line ranges when attempting to deal with an if (then, elif, else) fi construct. Again too early for me to say this is not my issue until after I clean up some more detection problems.
I imagine answering the above may help resolve some of these other issues I believe I should spend more time attempting to resolve on my own.
-
Until my comments were not detected I did use "Language > User Defined Language > Define your language ". – that is what I called the UDL editor and where the references to “Comment and Number tab” for either “Comment Line Style” or “Comment Style” boxed text fields 3 in comment line style and 2 in comment style.
I then edited both actual XML file finding the two keyword references I noted the Keywords entry I posted where I expect that the 0, 1 & 2 entries should populate the “Comment Line Style” text boxes which they appear not to be populating. Likewise entries 3 & 4 should populate the “Comment Style” text boxes. Anything I enter in those boxes appears NOT TO MAKE IT INTO the xml file. (meaning the data is not getting to the XML file when entered and it is not being populated from an existing XML file I did not create. So I then edited the Markup predefined entries using the UML EDITOR as noted above and found the entries for 0, 2, 3 & 4 did not appear in the expected text boxes noted above even when the data was present in the XML file itself an XML file NOT created by me.
-
I am not heavily invested. I can delete the entire portable application and start again. This time I will document every step. The first test I recommend is to open the UDL editor and select one of the Markup-predefined options and displaying the Various tabs in the UDL editor windows as they compare to the actual XML data.
I probably should provide a copy of the XML file I have loaded which should be the same as the one you sent in the installer zip file. And screen prints noting where data appears to be missing. That test will involve no actual creation of files by me. Does that sound reasonable? Is there anything other that the portable folder I unzipped I need to get rid of to have a fresh environment before starting? -
I created a new language called “Pasha”. I set Comment Line Style Open to
#
, and Comment Style Open=/*
and Close=*/
.I then exited Notepad++ to get it to save, then opened the XML. I correctly see:
... <UserLang name="Pasha" 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">00# 01 02 03/* 04*/</Keywords> ...
So it is populating for me. So I don’t know what you are doing wrong that it “appears NOT TO MAKE IT INTO”.
-
And in this example, I can make Folding In Comment work.
<NotepadPlus> <UserLang name="Pasha" 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">00# 01 02 03/* 04*/</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">CommentFolderOpen</Keywords> <Keywords name="Folders in comment, middle"></Keywords> <Keywords name="Folders in comment, close">CommentFolderClose</Keywords> <Keywords name="Keywords1"></Keywords> <Keywords name="Keywords2"></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="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="COMMENTS" fgColor="008080" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="LINE COMMENTS" fgColor="008040" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFF80" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" /> </Styles> </UserLang> </NotepadPlus>
-
If you want
#case#
to be your indicator, then you need to remember the#
is the start of comment, so it doesn’t go in the Folding in Comment boxes. Here’s working with#case#
,#cond#
, and#esac#
in the code getting interpreted properly as Folding in Comments: -
BTW: my general procedure for starting a new UDL: I open the dialog, immediately Save As… and give it a name (without having made any settings yet). Then I Export… into the
userDefineLangs\
directory. Then I Remove it. I know, that doesn’t make intuitive sense, but this is because I want the UDL in its own file, rather than in the olduserDefineLang.xml
contains-all-UDLs file. I then restart Notepad++, and it reads the definition from theuserDefineLangs\
directory, so it’s available again. Then I start editing the UDL.You don’t have to do it that way… but that’s just how I do it.
-
@peterjones This last comment makes great sense. I will try again. However without reloading I mapped the Markdown preinstalled dark mode to the various screens.
yellow, green, blue, gray and purple all appear to match.
the red appears to be missing.
-
I already showed exactly where 3 of the 5 Comment Line Style and Comment Style settings get saved, and the other two obviously fit between.
<Keywords name="Comments">00# 01 02 03/* 04*/</Keywords>
The 00 maps to Comment Line Style Open; 01 and 02 to the middle and close. 03 is Comment Open and 04 is Comment Close.
And my screenshot showed that they were properly coloring.
I don’t know what more I can show you.
-
@peterjones I thank you for your efforts.
-
-
I downloaded the file (001-download)
I extracted to an empty directory (002-extract)
I created an exported empty file as you wisely suggested. (003-EmptyExportedFile)
I removed the file I exported.
I restarted NP++
I updated three entries, ext and two comment entries (004-restartNP++_n_update)here is the updated file (005-updatedfile) the ext change made it into the file the two comment entries did not.
Again many thanks your suggestion about creating separate files was great.
-
I tried this using 4 flavors of 8.3.1 install 64 & 32 bit and portable 64 & 32 bit – they all failed for me. POSITIVE NEWS – I then tried 8.2.1 portable 64 bit it works for me just like your example. If there is a problem it appears to be in 8.3.1.
Thanks – looks like 8.2.1 may be the answer for me.
-
I must apologize for being obtuse.
After looking into this report and this issue #11239, it looks like v8.3.1 is doing something weird with the UDL comment entries, but worked properly in v8.3 and earlier. I now think there was a regression in the UDL Comment handling in v8.3.1. Given the description you showed above – especially with the XML showing single-digit rather than double-digit in the tag value – I believe the problems you were having with Comment Line syntax are caused by the same issue.
Hopefully it will be fixed in the next release of Notepad++ – until then, stick with v8.2.1. And again, sorry for not groking what you were trying to say.