Community
    • Login

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

    Scheduled Pinned Locked Moved General Discussion
    foldingcommentsjavascriptbug
    3 Posts 2 Posters 2.0k Views 2 Watching
    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.
    • Gilles GipoG Offline
      Gilles Gipo
      last edited by

      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
      • dailD Offline
        dail
        last edited by

        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)
        
        Gilles GipoG 1 Reply Last reply Reply Quote 2
        • Gilles GipoG Offline
          Gilles Gipo @dail
          last edited by

          @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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors