mechanically indent your code in VSCode
editor.autoIndent flag to
true in the configuration in order to enable it. To do that without touching the JSON shape files, follow the steps below to change global drug user settings in GUI mode :
Ctrl+Shift+Pto open Command Palette. Type in settings and select Open User Settings.
- In Search settings box, input indent to search for settings related to indentation. Select full in Editor: Auto Indent section.
- Automatic indentation is now enabled. Changes are saved automatically and applies to all opened files as well.
Indent your code in VSCode on need
To be able to properly indent your code anytime you want, you would need to install a linter or formatter or beautifier extension which supports your scheduling terminology. The linter should work like a spell checker, foreground errors, bugs and provide redress steering. here is a non-comprehensive list of linters for respective programming languages you can install from inside VSCode Marketplace .
- markdownlint : Markdown
- Python : Python
- Kotlin : Kotlin
You can find more extensions by searching in the VSCode Marketplace.
once you get the appropriate extension installed, you can press Shift + Alt + F to automatically format the document. alternatively, press Ctrl + Alt + P to open Command Palette and search for Format Document achieve the same leave .
Auto indentation on save in VSCode
From version 1.6, ocular Studio Code added support for automatic format upon document saving with
editor.formatOnSave flag. To enable the feature, follow the steps below .
Ctrl+Shift+Pto open Command Palette. Type in settings and select Open User Settings. Alternatively, press Ctrl + ,.
- In Search settings box, input format on save to search for settings related to document formatting. Check the box below Editor: Format On Save that says A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down
- Similarly, you can also enable Format on Paste, which automatically format pasted content as well as indentation.
Click to pace this position !
You have already voted for this article