Bug Fold All/Unfold All: cause // { comments

  • Notepad++ v7.5.4
    I wondered why the “Fold All (Alt+0)” didn’t work for a unique module of functions (javascript).
    (after 4 functions folded, the 5th and following were unfolded)

    I’ve found the reason :
    folding/unfolding can see the { and } in the comment lines ! With bad understanding…
    Ex :

    var module = (function(){
        function myfunc(){// can be folded but not the following functions
            for(var i=0; i<myVar.length; i++){
                //if(i != iTab){ // cause of the bug : the { in a comment
         function myfunc2(){// can't be folded by "View..Fold All"

    If it can help… :)

  • This is not a bug, but rather a confusing feature that is implement by Scintilla (the core piece Notepad++ uses). It allows //{ and //} to be used to create custom fold points. You can turn this off but you need a plugin such as LuaScript or PythonScript. With LuaScript if you edit the startup script you can add the following lines and restart N++:

    npp.AddEventHandler({"OnSwitchFile", "OnLangChange"}, function()
    	if editor.LexerLanguage == "cpp" then
    		editor.Property["fold.cpp.comment.explicit"] = "0"

  • @dail Oh ! OK, I understand, now…
    It’s totaly logic, but I dindn’t think to see in that direction.

    The solution is easy to find, now : I only have to cope with this, and avoid to stick those specific characters :)
    …and it works!
    Thanks! :D

            //if(i != iTab){ // a space beetween { and //
            // } // a space beetween // and }