Home >Development Tools >VSCode >Several VSCode code tips and tricks worth collecting [animation demonstration]

Several VSCode code tips and tricks worth collecting [animation demonstration]

青灯夜游
青灯夜游forward
2022-06-07 18:21:353372browse

This article summarizes and shares with you some VSCode code tips and tricks worth collecting. Hurry and save them, maybe you will use them often in the future!

Several VSCode code tips and tricks worth collecting [animation demonstration]

[Recommended learning: "vscode introductory tutorial"]

Code folding

Keyboard shortcuts: Ctrl Shift [ and Ctrl Shift ]

Several VSCode code tips and tricks worth collecting [animation demonstration]

Trim trailing spaces

Keyboard shortcuts: Ctrl K Ctrl The actual operation is Ctrl K, then Ctrl X.

Currently Ctrl K key is basically defined as an operation related to files, while Ctrl K Ctrl key is mostly an operation related to layout etc.Several VSCode code tips and tricks worth collecting [animation demonstration]

Code formatting

Currently selected source code: Ctrl K Ctrl F Entire document format: Shift Alt F

Move rows up and downSeveral VSCode code tips and tricks worth collecting [animation demonstration]

Keyboard shortcuts: Alt Up or Alt Down

Multiple cursor selection Several VSCode code tips and tricks worth collecting [animation demonstration]

Keyboard shortcuts: Ctrl Alt up key or Ctrl Alt down key

This feels very convenient

You can use Ctrl Shift L to add an additional cursor to all instances of the current selection Several VSCode code tips and tricks worth collecting [animation demonstration]

If you don't want to add all currently selected items, you can use Ctrl D instead. This will only select the next event after the event you selected, so you can add selections one by one.

Several VSCode code tips and tricks worth collecting [animation demonstration]

Copy lines up/downSeveral VSCode code tips and tricks worth collecting [animation demonstration]

Keyboard shortcuts: Shift Alt Up Arrow or Shift Alt Down key

When multiple cursors are selected, only the value of the first row will be copied

Several VSCode code tips and tricks worth collecting [animation demonstration]

Column (Box) Selection

You can select blocks of text by holding down Shift Alt (Shift Option on macOS) while dragging the mouse. A separate cursor will be added to the end of each line.

Several VSCode code tips and tricks worth collecting [animation demonstration]pee

)Peek

Select a symbol and enter Alt F12. Alternatively, you can use the context menu.

Go to definition: Select a symbol and type F12

Go to reference: Select a symbol and type Shift F12

Several VSCode code tips and tricks worth collecting [animation demonstration]

Attached is the official document


https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_preventing-dirty-writes

If it helps you, I can Like?

For more knowledge about VSCode, please visit:

vscode tutorial
!

The above is the detailed content of Several VSCode code tips and tricks worth collecting [animation demonstration]. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete