Skip to content

Commit 778b0e6

Browse files
committed
add chapter about commenting out and uncommenting in vscode
1 parent a116991 commit 778b0e6

File tree

1 file changed

+16
-1
lines changed
  • app/web_development/posts/vscode

1 file changed

+16
-1
lines changed

app/web_development/posts/vscode/page.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,28 @@ The easiest way to save a file in VSCode is to use the keyboard shortcut `Ctrl+S
177177
> [!MORE]
178178
> [VSCode "Editing basics" documentation](https://code.visualstudio.com/docs/editor/codebasics)
179179
180+
## Comment out / uncomment code
181+
182+
One of the must used shortcuts is probably the **comment out / uncomment toggle shortcut**
183+
184+
* first select the code you want to comment out or uncomment
185+
* then either use the shortcut `Ctrl+#` (macOS: `⌘#`, Linux: `Ctrl+#`)
186+
* or if you prefer using the command, [open the commend palette](#vscode-command-palette), start typing `Toggle Line Comment` until the command appears in the list and then select it.
187+
188+
VSCode will **comment out** out the select lines of code if they are NOT commented out yet, if they are commented out VSCode will uncomment them
189+
190+
VSCode will try to use language specific comments, meaning it will for example use `<!-- HTML comments -->` in HTML and `// single-line comments` in javascript (typescript).
191+
192+
> [!NOTE]
193+
> If you prefer using a multi-line comment, then use the related **toggle block comment** command shortcut `Ctrl+Shift+A` (macOS: `⇧⌘A`, Linux: `Ctrl+Shift+A`).
194+
180195
## Open a VSCode terminal
181196

182197
VSCode has a terminal (command line tool) that, by default, is closed. To open the terminal, click on **View** in the top navigation bar and then **Terminal**
183198

184199
Or use the keyboard shortcut `` Ctrl+` `` (macOS: `` ⌃` ``, Linux: `` Ctrl+` ``)
185200

186-
The third option is to use the command palette by pressing using the keyboard shortcut `Ctrl+Shift+p` (macOS: `⇧⌘P`, Linux: `Ctrl+Shift+P`) and then typing `view: toggle terminal`.
201+
The third option is to use the command palette, [open the commend palette](#vscode-command-palette), start typing `view toggle terminal` until the command appears in the list and then select it.
187202

188203
> [!MORE]
189204
> [VSCode "terminal" documentation](https://code.visualstudio.com/docs/terminal/basics)

0 commit comments

Comments
 (0)