• Login
Community
  • Login

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

Scheduled Pinned Locked Moved General Discussion
foldingcommentsjavascriptbug
3 Posts 2 Posters 1.7k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    Gilles Gipo
    last edited by Feb 26, 2018, 7:57 PM

    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… :)

    1 Reply Last reply Reply Quote 0
    • D
      dail
      last edited by Feb 26, 2018, 11:48 PM

      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"
      	end
      end)
      
      G 1 Reply Last reply Feb 27, 2018, 7:22 AM Reply Quote 2
      • G
        Gilles Gipo @dail
        last edited by Feb 27, 2018, 7:22 AM

        @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 }
        
        1 Reply Last reply Reply Quote 1
        1 out of 3
        • First post
          1/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors