How to force UDL change to take effect
-
The UserDefLang editor is not fully intuitive, or documented. For the most part it is brilliant, but I can’t figure this out.
When a change is made (for example, removing all the “middle” words in code folding1), what triggers the changes to take effect?
I had this:
Open:
[if ]
Middle:
[((else elseif)) ]
Close:
[endif ]However, folding at an elseif (inside a nested if structure) would fold all the way down to the lowest endif
So, I removed everything from the Middle field:
Middle:
[ ]But even after closing/reopening NPP, the elseif and else lines show the code folding indicators.
How can I force this change to take effect?
-
@gibberishbc ,
Insufficient data. You should post your debug information (?->Debug
), so that folks that may help you have a better understanding of what you’re working with, and you should post code according to the Forum standards so people can see and work with the actual data that you really mean, rather than what you try to present here. Check this FAQ for learning how to post code, text so it shows exactly as you are dealing with it and how you want it to look.
Some of your problem looks somewhat familar, like you are having conflicts with your UDL, but since we don’t know what is actually being worked with, because of your non-standard formatting and lack of debug information, it’s going to be a crapshoot what it is you really mean. You could have a plugin conflict as well, and the debug information would show that to the more knowledgeable users here to perhaps quickly identify the problem. Garbage in, garbage out. :) -
the document is updated as soon as the UDL dialog detects a change.
Folding is a part of UDL where there are a few rough edges, but as @Lycan-Thrope mentioned, without more details it is hard to guess what exactly you have done and if this is a problem of UDL or your configuration. -
@Lycan-Thrope said in How to force UDL change to take effect:
you should post code according to the Forum standards
Yeah, odd about that…
After posting the question, I realized I had neglected to CODE-ify (like that? Feel free…) the code snippet and immediately edited the post and surrounded code with triple-backticks (all edits completed within 3 or 4 mins), but there was no way to save - there was no SUBMIT button. So I puzzled around that for ten or so minutes, then called it a night. When I booted up this AM, the edited post was still in the editor, and now there was a submit button … but unable to save because “You can only edits posts for 180 minutes after posting” message.
Thinking about it, I SUSPECT… the problem might be due to using the Brave browser. I’ll keep gerfingerpoken and confirm over time.
As for the advice about the debug information, many thanks! I will do that next time (which will be very soon, probably).
PS - I just edited this post - created it and am now editing it - using Google Chrome, and … No Problems. Suggest you guys test this forum with Brave Browser and then (if you confirm my observations/frustrations) add a disclaimer to the home page if this browser detected.
-
@Lycan-Thrope
HEre’s the debug info:Notepad++ v8.4.2 (32-bit) Build time : May 29 2022 - 16:45:17 Path : C:\Program Files (x86)\Notepad++\notepad++.exe Command Line : $COMMAND_LINE_PLACEHOLDER$ Admin mode : ON Local Conf mode : OFF Cloud Config : OFF OS Name : Windows 10 Enterprise (64-bit) OS Version : 1903 Current ANSI codepage : 1252 Plugins : ComparePlugin (2.0.1) EmmetNPP (1.0.2) mimeTools (2.8) NppConverter (4.4) NppExport (0.4) NppFTP (0.29.7) NppQCP (2) PythonScript (2)
And here’s the structured code from the first question:
I had this:
Open: [if ] Middle: [((else elseif)) ] Close: [endif ]
However, folding at an elseif (inside a nested if structure) would fold all the way down to the lowest endif
So, I removed everything from the Middle field:
Middle: [ ]
-
Since your two words,
else
andelseif
, theelse
is also found inelseif
, it will try the matches in order (from left to right), soelse
will match theelse
portion ofelseif
, and then (if you are in FOLDING1 instead of FOLDING2) theif
will match the start of a new foldingIf you swap the order, so it’s
((elseif else))
, then it should do what you want (it fixed the folding for me by just changing the order).When working with multiple possibilities for matching (whether in regex for search/replace, or more simple combos like available in UDL), you must match the longer term then the substring, rather than the other way around.
-
@PeterJones
Good catch - thanks!