admin管理员组

文章数量:1406312

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?

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?

Share Improve this question asked Mar 5 at 21:58 2ndQuantized2ndQuantized 1725 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 2

Shift+ Alt+ I then Ctrl + /.

You can bind them using extension multi-command

Sometime back I wrote an extension specifically designed to do just what your are asking:

Toggle Line Comments.

Once you install the extension the default keybinding is Ctrl/Cmd+Alt+/

本文标签: