Community
    • Login

    Collapse level 2 not working for python language

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 1.1k 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.
    • Karun PoudelK Offline
      Karun Poudel
      last edited by

      Collapse level 1 works but Collapse level 2 doesn’t work for following Python code. [Notepad++ v7.5.8 (32-bit)].
      Language is set to Python.

      class C1:
          def f1():
              pass
          
          def f2():
              pass
      

      The fold margin shows the fold level correctly. If i put cursor inside a function and click Collapse current level, then it works correctly.

      Is this a bug?

      Thanks,
      Karun

      1 Reply Last reply Reply Quote 1
      • PeterJonesP Offline
        PeterJones
        last edited by

        I tried on v7.5.6 32bit, and it seems to not work right for me: collapse level 2 doesn’t collapse the two def’s. When I switched to a different language (Perl), with

        sub blah {
            do     {
                tertiary: {
                    1;
                }
            };
            while(1) {
            }
        
        }
        

        I was able to properly collapse and uncollapse levels 1, 2, or 3 without difficulty in Perl; but if I switch the language to python, it will only do level 1.

        Thus, it doesn’t seem to be solely the fault of v7.5.8, and it seems to be limited to Python.

        I just searched the issues page, and found https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4633 already reported … Based on what they said there (each space if indent gives a new level), I tried to collapse level 5 on your example, and the two def’s collapsed. So the bug isn’t with Notepad++, it’s with the Python-lexer that comes bundled with Scintilla that comes bundled with Notepad++. And it appears that it’s not going to be fixed, because the author disagrees that it’s a bug (it’s working as he designed it, apparently).

        So you might have to get used to calling a 4-space indent “level 5”. (sorry to be the bearer of bad news.)

        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