An Interest In:
Web News this Week
- April 29, 2024
- April 28, 2024
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
Configure Spacing in VSCode by Language
I like to use 2 spaces for indenting when writing HTML and 4 spaces for python, but it can be a pain adjusting the tabs or spaces settings in the command palette, as I would usually end up with the wrong spacing convention, which then takes time to refactor.
So I was wondering - is there a way to customise the spaces/tabs used per language? Well I did some research, and it turns out there
is! Read on below to learn how to create language specific settings within VSCode.
- Hit
ctrl
+Shift
+P
to open command palette and search settings - Select the option Preferences: Open User Settings (JSON)
This will open a JSON file in your editor. within the json you can include the following code:
"[python]": { "editor.detectIndentation" : false, "editor.insertSpaces": true, "editor.tabSize": 4 },
You can update the language and the number of spaces to be used in the tab size to your personal preferences, so for example if you choose 4, your indents will be 4 spaces long.
Have a quick check of your JSON file to make sure there is not already a language identifier already present (for example, this may have already been created if you've specified a formatter for that language). If the language identifier already exists, you can just add your keys and values to the existing record.
To find a list of language identifiers you can check out this document: VSCode Language Identifiers
There are tons of other settings you can configure using the settings.json file other than spacing and formatters, I've previously written an article covering fonts and ligatures:
Share in the comments below if there are any other configurations you use that make coding a breeze!
Original Link: https://dev.to/keracudmore/configure-spacing-in-vscode-by-language-1goo
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To