The code formatting is available in Visual Studio Code through the following shortcuts:
- On Windows Shift + Alt + F
- On Mac Shift + Option + F
- On Linux Ctrl + Shift + I
Alternatively, you can find the shortcut, as well as other shortcuts, through the submenu View / Command Palette
, also provided in the editor with Ctrl +Shift+ P (or Command + Shift + P on Mac), and then searching for format document.
For unsaved snippets
- Open command palette (Win: F1 or Ctrl+Shift+P)
- Find “Change Language Mode”
- Select language e.g.
json
. By now syntax should be highlighted. - Format document (e.g. Open Command Palette -> “Format Document“)
Unformat
- Select text
- Command Palette -> Join Lines