Config Files Need Updating, Too
-
@Coises ,
Edit to add 2: The problem with ControlledAutoIndent was entirely due to a mistake in that plugin. It’s not even a “conflict,” just a straight-up error. I had no idea what would cause an “External Lexer” to be used. (The plugin keeps track of the current language so it knows what indentation rules to apply.) I made a silly mistake in the code that handles the External Lexer case, and just never hit it until now.
I’m not sure why the ConfigUpdater plugin would trigger your plugin to think there was an External Lexer (it is not a lexer plugin, after all)… but I’m glad you found that one.
Edit to add: I continue to get the Access Violation in the second phase even after removing all plugins except ConfigUpdater. I will continue to search for the causes of both errors.
Access Violation implies that there’s a null pointer someplace. I thought I’d fixed that for all the styler/themes, but with
langs.xml
being the last message in the status, maybe I didn’t check properly in the langs-updater. I’ll go take a look. (However, my normal debug in Win11 and my VM+Win10 tests all worked just fine for both themes and langs, so I still cannot reproduce the problem that’s causing that, so even if I find something, I’ll have to rely on you to test if I’ve actually fixed it.While I am looking, could you try to do CANCEL instead of YES, and see if you still get the Access Violation at
langs.xml
when you are not running in Admin mode?update 1: I see you posted a reply just before my post: thank you for that Call Stack: I will start my search at line 1077. :-)
update 2: could you go to the issues page and create a new issue (this Access Violation is separate from the freeze/crash, I think), and attach your
langs.xml
to the issue? Maybe with that file, I’d be able to reproduce the problem. -
@PeterJones said in Config Files Need Updating, Too:
I’m not sure why the ConfigUpdater plugin would trigger your plugin to think there was an External Lexer (it is not a lexer plugin, after all)… but I’m glad you found that one.
Apparently ErrorList is an external lexer, and ControlledAutoIndent is picking that up as the active language at some point.
While I am looking, could you try to do CANCEL instead of YES, and see if you still get the Access Violation at langs.xml when you are not running in Admin mode?
Same result (at least, superficially). However, I realize now that the switch to Admin mode was not happening when running under the debugger; the call stack I posted was happening with Notepad++ not in Admin mode. I don’t know if there is a way I can trap an error in the debugger while running with elevated permissions.
update 2: could you go to the issues page and create a new issue (this Access Violation is separate from the freeze/crash, I think), and attach your langs.xml to the issue? Maybe with that file, I’d be able to reproduce the problem.
I will do that shortly.
-
@Coises said in Config Files Need Updating, Too:
Apparently ErrorList is an external lexer, and ControlledAutoIndent is picking that up as the active language at some point.
I guarantee it is not: it is a standard Lexilla lexer. Did you update your
menuCmdID.h
file which defines the external lexer constants?
…
No, it doesn’t look like you have:
But since it’s IDM_LANG+93 vs IDM_LANG+165, and you shouldn’t be looking at the IDM, that’s not the likely culprit (though something you should still fix)
Ah, searching for
external
in your plugin:
it’s using the L_xxxx enumeration values from the Notepad_plus_msgs.h::LangType
enumerationAnd that makes sense: Don chose to use whatever the “last” enumeration value happens to be for
L_EXTERNAL
, which means that every time a new built-in language is added, all plugin authors who compare vs L_EXTERNAL must updateNotepad_plus_msgs.h
whenever N++ does, otherwise their comparison will be off for anyone using one of the newer lexers in the most recent N++.So definitely update
menuCmdID.h
andNotepad_plus_msgs.h
, and then that comparison should not be true, and it won’t go into that section of code erroneously. -
@PeterJones said in Config Files Need Updating, Too:
it’s using the L_xxxx enumeration
Thank you. It appears (since of course updates could always happen without a plugin being updated) that I’ll need to find a way to determine what is an external lexer at run time (not just what would have been an external lexer when I compiled the plugin).
-
@Coises ,
Glad you guys figured it out. I was really tired when testing this, and realized after I signed off and shut down the computer that I had already tested without WebTools, before I got impatient and removed all the plugins, since I started from the bottom alphabetically and was working to the top.So the problem that was happening for me, was probably just the AutoIndent plugin, and I say probably because I can’t be sure the combo of it with another, possibly WebTools, couldn’t have been the culprit. I’d been up close to 21 hours when I shutdown and couldn’t force myself to sign back on. :-(
-
v2.0.1, with bugfix for @Coises “Access Violation” is released on GitHub. I have “paused” my nppPluginList submission, but will most likely submit 2.0.1 to the plugin list tomorrow, unless something else is discovered.
For those who want details:
Bugfix: Fix an “Access Violation” that occurs with specific condition of old langs.xml
vs newlangs.model.xml
– when the model had<Language name="blah"><Keywords ...></Language>
but the oldlangs.xml
only had empty<Language name="blah"/>
, it would cause the plugin to crash. The logic has been fixed so it properly copies over the new<Keywords ...>
into the previously-empty<Language>
element. -
@Lycan-Thrope said in Config Files Need Updating, Too:
So the problem that was happening for me, was probably just the AutoIndent plugin, and I say probably because I can’t be sure the combo of it with another, possibly WebTools, couldn’t have been the culprit.
For what it’s worth, as the author of Controlled Auto-indent, I can guarantee it was the culprit. It could crash under other circumstances, too, having nothing to do with ConfigUpdater; I just hadn’t hit one of them, and if anyone else did before you, they didn’t report it.
-
@Coises said in Config Files Need Updating, Too:
For what it’s worth, as the author of Controlled Auto-indent, I can guarantee it was the culprit. It could crash under other circumstances, too, having nothing to do with ConfigUpdater; I just hadn’t hit one of them, and if anyone else did before you, they didn’t report it.
I appreciate that, and I’ll go ahead and download it and test it against the old and new versions of ConfigUpdater. I’ve already downloaded, but not installed the new version of CU yet.
Update: It works fine under the old CU and the new CU. I tried it with CAI enabled and not enabled, and the CU ran through everything, so the crash condition from CAI appears to be gone. Glad I could help find that edge case, unknowingly. :-)
-
ConfigUpdater Plugin v2.1.0
ConfigUpdater Plugin has released v2.1.0, available thru GitHub release page.
- Add Dark Mode (Issue #7)
- Validate XML vs XSD during update (Issue #1) and interactive validation on-demand (Issue #14)
- Add ability to download most recent model XML files (Issue #19)
- Other Improvements: move config to dedicated subdirectory (Issue #6), only write XML file if it is changed (Issue #3), truncate the status logfile if it’s too big (Issue #10), make sure it only updates themes once for portable (Issue #15)
-
@PeterJones ,
Just curious. Files that are flagged as invalid, what’s the recourse desired? I thought using the Validate Files would correct whatever was found after running ConfigUpdate that flagged those files and lines in the log.I have two showing up:
One in stylers.xml
--- ConfigUpdater run at Friday, July 4, 2025 4:55:40 AM --- Checking Styler/Theme File: 'C:\Users\camilee\AppData\Roaming\Notepad++\stylers.xml' + LexerStyles: Sorted LexerType elements alphabetically (keeping "searchResults" at end) ! Validation of C:\Users\camilee\AppData\Roaming\Notepad++\stylers.xml failed on line#1685: XML validation FAILED: '2' is a duplicate key for the unique Identity Constraint 'unique-WordsStyle-styleID'. Line#1685: <WordsStyle bgColor="FFFFFF" fgColor="000000" fontName="" fontSize="" fontStyle="0" name="COMMENT LINE" styleID="2"/>
…and a multiple fail in DarkModeDefault:
--- Checking Styler/Theme File: 'C:\Users\camilee\AppData\Roaming\Notepad++\themes\DarkModeDefault.xml' + LexerStyles: Sorted LexerType elements alphabetically (keeping "searchResults" at end) ! Validation of C:\Users\camilee\AppData\Roaming\Notepad++\themes\DarkModeDefault.xml failed on line#657: XML validation FAILED: '5' is a duplicate key for the unique Identity Constraint 'unique-WordsStyle-styleID'. Line#657: <WordsStyle name="EVENT" styleID="5" fgColor="8CD0D3" bgColor="3F3F3F" fontName="" fontStyle="1" fontSize="" keywordClass="instre2"/> --- Checking Styler/Theme File: 'C:\Users\camilee\AppData\Roaming\Notepad++\themes\MyDarkModeDefault.xml' + LexerStyles: Sorted LexerType elements alphabetically (keeping "searchResults" at end) ! Validation of C:\Users\camilee\AppData\Roaming\Notepad++\themes\MyDarkModeDefault.xml failed on line#652: XML validation FAILED: '5' is a duplicate key for the unique Identity Constraint 'unique-WordsStyle-styleID'. Line#652: <WordsStyle bgColor="3F3F3F" fgColor="8CD0D3" fontName="" fontSize="" fontStyle="1" keywordClass="instre2" name="EVENT" styleID="5"/>
There are others for DarkMode as shown in this partial shot of the Validate box since I can’t screenshot the whole text since the box isn’t wide enough and it can’t be copied for inclusion in here under code format.
I see that double clicking the line, takes me to the file, and then I can double click the FunctionList view that leaves me on and that will bring up the line in the file, but the question remains…what am I supposed to change it to, or am I supposed to change it at all?My viewing the new aspects made me believe the validation and correction was automatic by clicking those functions along with the Download new models. I fear I may just not know what these new capabilities are supposed to perform, so I don’t want to assume what they are supposed to do. Guidance?
-
@Lycan-Thrope said in Config Files Need Updating, Too:
I thought using the Validate Files would correct whatever was found
…
My viewing the new aspects made me believe the validation and correction was automatic by clicking those functions … Guidance?Sorry, I was hoping the section on Validation in the README would be enough. I guess I need to add a help button and see if I can explain things better.
The validation has occurred, and it has found errors.
Unfortunately, I cannot program enough intelligence into the plugin to be able to figure out the right/best way to fix the problems, so it does not correct errors for you. That’s why the double-click will take you to the right spot in the problematic XML file. Further, the stylers.model.xml button can be used to open the model file side-by-side with the problematic XML – and the plugin will do its best to align the model file so that it’s showing the same section of its XML as has the problem in the other (though, looking at the order that line#652 is listed, I think my alignment algorithm might need some work: that line proved assumptions wrong).
You are then supposed to compare the two, and use the semi-understandable XML error messages to help you figure out… Maybe I’ll have to figure out a way to convert the errors that the validation library spits out into something more human-readable.
'5' is a duplocate key...
indicates that there are two<WordsStyle>
entries that have the same StyleID. StyleID must be unique for Notepad++ to be able to correctly map that row in the XML (or that entry in the Style Configurator’s Styles: list) to the underlying Lexilla style. When there are two with the same StyleID, Notepad++ only picks one to show in the Style Configurator and send to Lexilla. So you need to compare your XML with the model XML, and figure out what the right solution is:- Do you just need to pick one of the two duplicates and delete it (and if so, your human intelligence is needed to decide which is the right entry to keep and which to delete)
- Or does one of them have the wrong styleID, and you just need to change it to a different value
'' violates enumeration constraint...
indicates that you have a keywordClass attribute on your<WordsStyle>
that has an invalid value (in your case, the empty string). keywordClass needs to be one of the known types as listed in the error message, or the attribute needs to not exist at all.- You need to compare the failing XML to the model, and need to figure out what value of keywordClass should be there – or whether to delete the attribute altogether (if it’s not there for that styleID in the model)
along with the Download new models. I fear I may just not know what these new capabilities are supposed to perform, so I don’t want to assume what they are supposed to do.
The Download Newest Model Files grabs the most recent
stylers.model.xml
andlangs.model.xml
from the Notepad++ repo, and overwrites your possibly-out-of-date models. This will make sure that the model used when validating is the “current best practice” found in the repo. (I really thought that the README was clear on that one. Is it not?)since I can’t screenshot the whole text since the box isn’t wide enough and it can’t be copied for inclusion in here under code format.
Created issue #23: I’ll see if I can get
Ctrl+C
and/or dialog resize to work. (I’ve never done either from C++; I really don’t have a lot of GUI-programming experience, so I’ve always started with “functional enough GUI for me to do what I want” for my plugins, without aiming for super-fancy features.)