Home >Development Tools >VSCode >Several VSCode code tips and tricks worth collecting [animation demonstration]
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!
[Recommended learning: "vscode introductory tutorial"]
Code folding
Keyboard shortcuts: Ctrl Shift [ and Ctrl Shift ]
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.
Code formattingCurrently selected source code: Ctrl K Ctrl F Entire document format: Shift Alt F
Move rows up and down
Keyboard shortcuts: Alt Up or Alt Down
Multiple cursor selection
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
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.
Copy lines up/down
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 copiedColumn (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.
(pee
)PeekSelect 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 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!