Issue if Folding in code
-
Hi all
I use Notepad++ to code in a language for Igor Pro by Wavemetrics. I’ve used user defined language for years. Recently, the folding in code has stopped working properly. It starts and stops at seemingly random spots.
Below I have the settings I have been using and some example code, which the issue visible.
Thanks for any help
Debug output
Notepad++ v8.7.7 (64-bit)
Build time : Feb 6 2025 - 03:19:13
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : ON
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
OS Name : Windows 11 Pro (64-bit)
OS Version : 24H2
OS Build : 26100.3194
Current ANSI codepage : 1252
Plugins :
mimeTools (3.1)
NppConverter (4.6)
NppExport (0.4) -
@Zachary-Decker said in Issue if Folding in code:
Recently, the folding in code has stopped working properly.
Nothing has changed recently with the implementation of User Defined Languages (UDL).
But UDL has never been perfect, and over the years, I’ve seen plenty of times when UDL code-folding gets out-of-sync with the file. It often happens when the first line of the file in question is a comment line or beginning of a comment block. Given that your first line has a comment on it, that might be the culprit. Sometimes (as described in this issue) users are able to get it to re-sync the fold points by choosing Language > None and then choosing Language >
<name of UDL>
to do a manual reset; but that’s not a guarantee.You don’t show your Comment & Number settings, but this official issue reports that setting the
Allow folding of comments
option on that tab of the UDL might “break” the normal UDL folding for you. If you don’t need comment-folding, I would suggest turning it off, and see if it helps the other folding to work more reliably. -
Thanks for the reply. I followed your suggestions, but these did not resolve the issue.
However, I did find a solution after much troubleshooting. You noted that there can be issues if the first line is a comment. This is not the case in my file, but I realized the folding issue was correlated with the number of comments. Playing around with the Comment settings in the Comment & Number tab shows this to be true. I had some strange settings going on in there which worked for the comments, but screwed up the folding.
Removing the Comment Style settings fixed the issue.
Thanks
Zach