Get the App
SLTechnology News&Howtos  ›  Servers  › 

Visual Studio Code- add or remove comment lines in batch

Shulou Source: shulou.com Published: 2022-06-03 00:01:17 09月22日 Update

For example, delete Visual Studio code or notepad++ comment messages in batches to facilitate reading valid code or text information. The specific operations are as follows:

Visual Studio Code batch delete comment line information:

In VS Code, we can use the Ctrl+h shortcut to call up the replacement interface, enter the regular expression ^ # corresponding to the blank line in the replacement lookup interface, and Alt+R select the corresponding regular expression search mode, and replace the batch with empty to clear the comment line information, as shown below:

1. Quickly open the replacement interface and enter ^ # in the Find interface. *

2.Alt+R selects Use Regular _ Expression (Alt+R), which is the regular expression pattern:

3. Select Replace All (Ctrl+Alt+Enter) to replace in batch to complete the operation. The screenshot is as follows:

If there is a space in front, you can add the corresponding space to replace it.

Visual Studio Code adds comments in batches:

Using shortcut keys, the default is as follows, and we can also customize it in the options interface:

Batch comments: Ctrl+K,Ctrl+C

Uncomment: Ctrl+K,Ctrl+U

Notepad++ batch delete comment line information:

Method 1: regular expression: ^ #. *

Method 2: graphical interface operation:

Notepad++ batch add comment line information:

Welcome to the official account of Wechat: Xiao Wen study Society.

Tags: Information annotations interfaces regularities expressions selections comments shortcuts methods patterns input valid appropriate code public available through graphics screenshots techniques text Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Redmi Apple Huawei Shulou Tech Info