[Python] VS Code Comment Toggle Behaviour Unexpected: Adds and removes comments, does not swap...

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    I have tried looking this up but I only find answers related to getting the toggle command to work at all, not about the specific issue I have.

    I was previously using Notepad++. For Python, when I would toggle the comment of two lines simultaneously, I would get the following behaviour:

    # Line 1
    Line 2


    After toggle:

    Line 1
    # Line 2


    Future toggles alternate between the two states above.

    I have not found a way to do this in VS Code (Ctrl + / ). The behaviour I see is

    # Line 1
    Line 2


    After toggle:

    # # Line 1
    # Line 2


    Toggle again:

    # Line 1
    Line 2


    The behaviour of Notepad++ is quite useful, but I can't find any discussion of it or how to get VSCode to behave similarly. The VSCode way is not useless, but the Notepad++ version is much more useful as I can always just use a comment command if I want to simply add a comment and not swap which lines are commented.

    Does anyone know how I can replicate the Notepad++ behaviour in VSCode?

    Continue reading...

Compartilhe esta Página