How to customize the tab-to-space conversion factor when using Visual Studio Code? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to set per-filetype tab size?How to change the per-language configuration of setting “editor.insertSpaces” to “auto”Copying code from Visual Studio Code to OneNote loses tab indentations even though syntax highlighting is retainedPreserve spacing on indent or outdent with tab in VSCodeVisual Studio Code tab widthHow to select tab-size in Visual Code Studio for pug lang?How can I configure wrapping indent size in VS Code?Too much space in loopManaging Indentation Settings in VS CodeVS Code - How do I change Format Document to use tabs instead of spacesMultiple cursors in Visual Studio CodeVertical rulers in Visual Studio Code?How do you format code in Visual Studio Code (VSCode)visual studio code compile on saveHow to use Visual Studio Code as Default Editor for GitHow do I collapse sections of code in Visual Studio Code for Windows?How do I hide certain files from the sidebar in Visual Studio Code?Hide .js.map files in Visual Studio CodeSpaces to tabs in Visual Studio CodeHow do I configure Visual Studio Code to open files always in a new tab?
Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?
How to get a flat-head nail out of a piece of wood?
Magento 2 Editing phtml files in Production Mode
RM anova or Factorial Anova?
Combining list in a Cartesian product format with addition operation?
Can two people see the same photon?
Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?
Can I feed enough spin up electron to a black hole to affect it's angular momentum?
IC on Digikey is 5x more expensive than board containing same IC on Alibaba: How?
Noise in Eigenvalues plot
Why do C and C++ allow the expression (int) + 4*5?
How to create a button that adds InputFields when clicked?
"Destructive power" carried by a B-52?
Flight departed from the gate 5 min before scheduled departure time. Refund options
Can anyone explain what's the meaning of this in the new Game of Thrones opening animations?
How to ask rejected full-time candidates to apply to teach individual courses?
draw a pulley system
How can I list files in reverse time order by a command and pass them as arguments to another command?
No invitation for tourist visa but I want to visit
How does Billy Russo acquire his 'Jigsaw' mask?
Lemmatization Vs Stemming
malloc in main() or malloc in another function: allocating memory for a struct and its members
Why did Israel vote against lifting the American embargo on Cuba?
Is there a verb for listening stealthily?
How to customize the tab-to-space conversion factor when using Visual Studio Code?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to set per-filetype tab size?How to change the per-language configuration of setting “editor.insertSpaces” to “auto”Copying code from Visual Studio Code to OneNote loses tab indentations even though syntax highlighting is retainedPreserve spacing on indent or outdent with tab in VSCodeVisual Studio Code tab widthHow to select tab-size in Visual Code Studio for pug lang?How can I configure wrapping indent size in VS Code?Too much space in loopManaging Indentation Settings in VS CodeVS Code - How do I change Format Document to use tabs instead of spacesMultiple cursors in Visual Studio CodeVertical rulers in Visual Studio Code?How do you format code in Visual Studio Code (VSCode)visual studio code compile on saveHow to use Visual Studio Code as Default Editor for GitHow do I collapse sections of code in Visual Studio Code for Windows?How do I hide certain files from the sidebar in Visual Studio Code?Hide .js.map files in Visual Studio CodeSpaces to tabs in Visual Studio CodeHow do I configure Visual Studio Code to open files always in a new tab?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
How to customize the tab-to-space conversion factor when using Visual Studio Code?
For instance, right now in HTML it appears to produce two spaces per press of TAB, but in TypeScript it produces 4.
visual-studio-code vscode-settings
add a comment |
How to customize the tab-to-space conversion factor when using Visual Studio Code?
For instance, right now in HTML it appears to produce two spaces per press of TAB, but in TypeScript it produces 4.
visual-studio-code vscode-settings
add a comment |
How to customize the tab-to-space conversion factor when using Visual Studio Code?
For instance, right now in HTML it appears to produce two spaces per press of TAB, but in TypeScript it produces 4.
visual-studio-code vscode-settings
How to customize the tab-to-space conversion factor when using Visual Studio Code?
For instance, right now in HTML it appears to produce two spaces per press of TAB, but in TypeScript it produces 4.
visual-studio-code vscode-settings
visual-studio-code vscode-settings
edited Apr 4 at 16:19
Braiam
3,59993566
3,59993566
asked Apr 30 '15 at 15:54
J. AbrahamsonJ. Abrahamson
49.5k7114160
49.5k7114160
add a comment |
add a comment |
17 Answers
17
active
oldest
votes
By default, Visual Studio Code will try to guess your indentation options depending on the file you open.
You can turn off indentation guessing via "editor.detectIndentation": false
.
You can customize this easily via these three settings for Windows in menu File → Preferences → User Settings and for Mac in menu Code → Preferences → Settings or ⌘,
:
// The number of spaces a tab is equal to. This setting is overridden
// based on the file contents when `editor.detectIndentation` is true.
"editor.tabSize": 4,
// Insert spaces when pressing Tab. This setting is overriden
// based on the file contents when `editor.detectIndentation` is true.
"editor.insertSpaces": true,
// When opening a file, `editor.tabSize` and `editor.insertSpaces`
// will be detected based on the file contents. Set to false to keep
// the values you've explicitly set, above.
"editor.detectIndentation": false
4
I have configured both settings to "auto", and the behavior is not as I expect (though I wouldn't go as far as to call it "wrong"). I don't know what file should be changed to support my convention, but I opened a uservoice ticket for that, as suggested in the answer to question #30057721
– Guss
May 7 '15 at 9:49
3
Is there also an option to set the default for new, blank files? There's not much to guess in that scenario and I think VSCode will default to using spaces (which I don't prefer)...
– Stijn de Witt
Oct 7 '16 at 12:43
3
This did not work when i tried it with a .json file.
– arcseldon
Oct 12 '16 at 12:32
5
Adding ` "editor.detectIndentation": false` worked in my case.
– arcseldon
Oct 12 '16 at 12:36
2
If you have the "prettier" extension installed, make sure to also set the prettier.tabWidth value to 4. I just ran in to this today. :)
– Jamie Nordmeyer
Aug 14 '18 at 19:28
|
show 9 more comments
I'm running version 1.21 but I think this may apply to earlier versions as well.
Take a look at the bottom right-hand side of the screen. You should see something that says Spaces
or Tab-Size
.
Mine shows spaces, -->
- Click on the
Spaces
(orTab-Size
) - Choose
Indent Using Spaces
orIndent using Tabs
- Select the amount of spaces or tabs you like.
This only works per document, not project-wide. If you want to apply it project-wide, you need to also add "editor.detectIndentation": false
to your user settings.
3
nice. just need to right click on the file then choose format code to do the conversion.
– Meirion Hughes
Aug 18 '16 at 11:09
7
Much clearer solution than the accepted answer. I could not even edit the file in the accepted answer. This actually worked.
– DarthOpto
Nov 8 '16 at 16:41
I'm using VS Code on Windows. Using the tab indicator on the status bar method to change tab settings works for most files but is not working in .cshtml files? Can anyone confirm?
– Darren Evans
Apr 12 '17 at 12:40
1
VSCode warns now ifeditor.detectIndentation
is set totrue
and you change theeditor.tabSize
. However, since the GUI forsettings.json
oruser-settings.json
it's easier to change this now.
– chriszo111
Nov 15 '18 at 14:13
add a comment |
Well, the new version of Visual Studio Code allows you to specify differently file type for the tabSize. Here is the example of my settings.json
with default 4 spaces and JavaScript/JSON 2 spaces:
// I want my default to be 4, but JS/JSON to be 2
"editor.tabSize": 4,
"[javascript]":
"editor.tabSize": 2
,
"[json]":
"editor.tabSize": 2
PS: Well, if you do not know how to open this file, you can: click left-bottom gear -> then settings
9
Beautiful. It works! Some quick addition to that, the thing between the brackets, if you look at the lower right corner of visual studio, you can spot the name to use! Check it out: tinypic.com/m/jr9nw1/3
– Jose A
Oct 6 '17 at 13:17
add a comment |
By default, Visual Studio Code auto-detects the indentation of the current open file. If you want to switch this feature off and make all indentation, for example, two spaces, you'd do the following in your User Settings or Workspace settings.
"editor.tabSize": 2,
"editor.detectIndentation": false
2
And if you want to leave "editor.detectIdentation": true, but still change the identation from spaces to tabs, you need to remove all identation in your file, save and close it, then reopen and do Format document.
– LoBo
May 26 '17 at 14:48
...why would you do that? Can't you just use the convert indentation command?
– celticminstrel
Aug 6 '18 at 16:04
add a comment |
We can control tab size by file type with EditorConfig and its Visual Studio Code extension. We then can make Alt + Shift + F specific to each file type.
Installation
ext install EditorConfig
Example Configuration
.editorconfig
[*]
indent_style = space
[*.cs,js]
indent_size = 4
[*.json]
indent_size = 2
settings.json
EditorConfig overrides whatever settings.json configures for the editor. There is no need to change editor.detectIndentation
.
add a comment |
You want to make sure your editorconfig is not conflicting with your user or workspace settings configuration, as I just had a bit of annoyance thinking the settings files settings were not being applied when it was my editor configuration undoing those changes.
add a comment |
That is lonefy.vscode-js-css-html-formatter
to blame. Disable it, and install HookyQR.beautify
.
Now on save your tabs wouldn't be converted.
add a comment |
In VSC version 1.31.1
or more (I think).
Like sed Alex Dima.
You can customize this easily via these settings for
- Windows in menu File → Preferences → User Settings or use short keys
ctr + shift + p
- Mac in menu Code → Preferences → Settings or ⌘,
add a comment |
If you use the prettier extension in vscode, try adding this to the settings.json file:
"editor.insertSpaces": false,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"prettier.tabWidth": 4,
"prettier.useTabs": true // this made it finally work for me
add a comment |
In your bottom-right corner, you have Spaces:
Spaces: 2
There you can change the indentation according to your needs:
Indentation Options
add a comment |
If the accepted answer on this post doesn't work, give this a try:
I had EditorConfig for Visual Studio Code installed in my editor, and it kept overriding my user settings which were set to indent files using spaces. Every time I switched between editor tabs, my file would automatically get indented with tabs even if I had converted indentation to spaces!!!
Right after I uninstalled this extension, indentation no longer changes between switching editor tabs, and I can work more comfortably rather than having to manually convert tabs to spaces every time I switch files - that is painful.
this was it for me.no matter how i changed my settings, every time i opened the file it would revert.
– Esteban
Feb 20 at 20:12
add a comment |
@alex-dima's solution from 2015 will change tab sizes and spaces for all files and @Tricky's solution from 2016 appears to only change the settings for the current file.
As of 2017, I found another solution that works on a per-language basis. Visual Studio Code was not using the proper tab sizes or space settings for Elixir, so I found that I could change the settings for all Elixir files.
I clicked on the language in the status bar ("Elixir" in my case), chose "Configure 'Elixir' language based settings...", and edited the Elixir-specific language settings. I just copied the "editor.tabSize" and "editor.insertSpaces" settings from the default settings on the left (I'm so glad those are shown) and then modified them on the right.
It worked great, and now all Elixir language files use the proper tab size and space settings.
add a comment |
Menu File → Preferences → Settings
Add to user settings:
"editor.tabSize": 2,
"editor.detectIndentation": false
then right click your document if you have one opened already and click Format Document to have your existing document follow these new settings.
add a comment |
When using TypeScript, the default tab width is always two regardless of what it says in the toolbar. You have to set "prettier.tabWidth" in your user settings to change it.
Ctrl + P, Type → user settings, add:
"prettier.tabWidth": 4
add a comment |
User3550138 is correct. lonefy.vscode-js-css-html-formatter
overrides all the settings mentioned in other answers. However, you don't have to disable or uninstall it as it can be configured.
Full instructions can be found by opening the extensions sidebar and clicking on this extension and it will display configuration instructions in the editor workspace. At least it does for me in Visual Studio Code version 1.14.1.
add a comment |
If this is for Angular 2, and the CLI is generating files which you would like differently formatted, you can edit these files to change what is generated:
npm_modules/@angular/cli/blueprints/component/files/__path__/*
Not massively recommended as an npm update will delete your work, but it has saved me a lot of time.
add a comment |
I tried to change editor.tabSize
to 4, but .editorConfig
overrides whatever settings I had specified, so there is no need to change any configuration in user settings. You just need to edit .editorConfig file:
set indent_size = 4
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29972396%2fhow-to-customize-the-tab-to-space-conversion-factor-when-using-visual-studio-cod%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
17 Answers
17
active
oldest
votes
17 Answers
17
active
oldest
votes
active
oldest
votes
active
oldest
votes
By default, Visual Studio Code will try to guess your indentation options depending on the file you open.
You can turn off indentation guessing via "editor.detectIndentation": false
.
You can customize this easily via these three settings for Windows in menu File → Preferences → User Settings and for Mac in menu Code → Preferences → Settings or ⌘,
:
// The number of spaces a tab is equal to. This setting is overridden
// based on the file contents when `editor.detectIndentation` is true.
"editor.tabSize": 4,
// Insert spaces when pressing Tab. This setting is overriden
// based on the file contents when `editor.detectIndentation` is true.
"editor.insertSpaces": true,
// When opening a file, `editor.tabSize` and `editor.insertSpaces`
// will be detected based on the file contents. Set to false to keep
// the values you've explicitly set, above.
"editor.detectIndentation": false
4
I have configured both settings to "auto", and the behavior is not as I expect (though I wouldn't go as far as to call it "wrong"). I don't know what file should be changed to support my convention, but I opened a uservoice ticket for that, as suggested in the answer to question #30057721
– Guss
May 7 '15 at 9:49
3
Is there also an option to set the default for new, blank files? There's not much to guess in that scenario and I think VSCode will default to using spaces (which I don't prefer)...
– Stijn de Witt
Oct 7 '16 at 12:43
3
This did not work when i tried it with a .json file.
– arcseldon
Oct 12 '16 at 12:32
5
Adding ` "editor.detectIndentation": false` worked in my case.
– arcseldon
Oct 12 '16 at 12:36
2
If you have the "prettier" extension installed, make sure to also set the prettier.tabWidth value to 4. I just ran in to this today. :)
– Jamie Nordmeyer
Aug 14 '18 at 19:28
|
show 9 more comments
By default, Visual Studio Code will try to guess your indentation options depending on the file you open.
You can turn off indentation guessing via "editor.detectIndentation": false
.
You can customize this easily via these three settings for Windows in menu File → Preferences → User Settings and for Mac in menu Code → Preferences → Settings or ⌘,
:
// The number of spaces a tab is equal to. This setting is overridden
// based on the file contents when `editor.detectIndentation` is true.
"editor.tabSize": 4,
// Insert spaces when pressing Tab. This setting is overriden
// based on the file contents when `editor.detectIndentation` is true.
"editor.insertSpaces": true,
// When opening a file, `editor.tabSize` and `editor.insertSpaces`
// will be detected based on the file contents. Set to false to keep
// the values you've explicitly set, above.
"editor.detectIndentation": false
4
I have configured both settings to "auto", and the behavior is not as I expect (though I wouldn't go as far as to call it "wrong"). I don't know what file should be changed to support my convention, but I opened a uservoice ticket for that, as suggested in the answer to question #30057721
– Guss
May 7 '15 at 9:49
3
Is there also an option to set the default for new, blank files? There's not much to guess in that scenario and I think VSCode will default to using spaces (which I don't prefer)...
– Stijn de Witt
Oct 7 '16 at 12:43
3
This did not work when i tried it with a .json file.
– arcseldon
Oct 12 '16 at 12:32
5
Adding ` "editor.detectIndentation": false` worked in my case.
– arcseldon
Oct 12 '16 at 12:36
2
If you have the "prettier" extension installed, make sure to also set the prettier.tabWidth value to 4. I just ran in to this today. :)
– Jamie Nordmeyer
Aug 14 '18 at 19:28
|
show 9 more comments
By default, Visual Studio Code will try to guess your indentation options depending on the file you open.
You can turn off indentation guessing via "editor.detectIndentation": false
.
You can customize this easily via these three settings for Windows in menu File → Preferences → User Settings and for Mac in menu Code → Preferences → Settings or ⌘,
:
// The number of spaces a tab is equal to. This setting is overridden
// based on the file contents when `editor.detectIndentation` is true.
"editor.tabSize": 4,
// Insert spaces when pressing Tab. This setting is overriden
// based on the file contents when `editor.detectIndentation` is true.
"editor.insertSpaces": true,
// When opening a file, `editor.tabSize` and `editor.insertSpaces`
// will be detected based on the file contents. Set to false to keep
// the values you've explicitly set, above.
"editor.detectIndentation": false
By default, Visual Studio Code will try to guess your indentation options depending on the file you open.
You can turn off indentation guessing via "editor.detectIndentation": false
.
You can customize this easily via these three settings for Windows in menu File → Preferences → User Settings and for Mac in menu Code → Preferences → Settings or ⌘,
:
// The number of spaces a tab is equal to. This setting is overridden
// based on the file contents when `editor.detectIndentation` is true.
"editor.tabSize": 4,
// Insert spaces when pressing Tab. This setting is overriden
// based on the file contents when `editor.detectIndentation` is true.
"editor.insertSpaces": true,
// When opening a file, `editor.tabSize` and `editor.insertSpaces`
// will be detected based on the file contents. Set to false to keep
// the values you've explicitly set, above.
"editor.detectIndentation": false
edited Dec 15 '18 at 17:59
Peter Mortensen
14k1987114
14k1987114
answered Apr 30 '15 at 16:02
Alex DimaAlex Dima
11k1812
11k1812
4
I have configured both settings to "auto", and the behavior is not as I expect (though I wouldn't go as far as to call it "wrong"). I don't know what file should be changed to support my convention, but I opened a uservoice ticket for that, as suggested in the answer to question #30057721
– Guss
May 7 '15 at 9:49
3
Is there also an option to set the default for new, blank files? There's not much to guess in that scenario and I think VSCode will default to using spaces (which I don't prefer)...
– Stijn de Witt
Oct 7 '16 at 12:43
3
This did not work when i tried it with a .json file.
– arcseldon
Oct 12 '16 at 12:32
5
Adding ` "editor.detectIndentation": false` worked in my case.
– arcseldon
Oct 12 '16 at 12:36
2
If you have the "prettier" extension installed, make sure to also set the prettier.tabWidth value to 4. I just ran in to this today. :)
– Jamie Nordmeyer
Aug 14 '18 at 19:28
|
show 9 more comments
4
I have configured both settings to "auto", and the behavior is not as I expect (though I wouldn't go as far as to call it "wrong"). I don't know what file should be changed to support my convention, but I opened a uservoice ticket for that, as suggested in the answer to question #30057721
– Guss
May 7 '15 at 9:49
3
Is there also an option to set the default for new, blank files? There's not much to guess in that scenario and I think VSCode will default to using spaces (which I don't prefer)...
– Stijn de Witt
Oct 7 '16 at 12:43
3
This did not work when i tried it with a .json file.
– arcseldon
Oct 12 '16 at 12:32
5
Adding ` "editor.detectIndentation": false` worked in my case.
– arcseldon
Oct 12 '16 at 12:36
2
If you have the "prettier" extension installed, make sure to also set the prettier.tabWidth value to 4. I just ran in to this today. :)
– Jamie Nordmeyer
Aug 14 '18 at 19:28
4
4
I have configured both settings to "auto", and the behavior is not as I expect (though I wouldn't go as far as to call it "wrong"). I don't know what file should be changed to support my convention, but I opened a uservoice ticket for that, as suggested in the answer to question #30057721
– Guss
May 7 '15 at 9:49
I have configured both settings to "auto", and the behavior is not as I expect (though I wouldn't go as far as to call it "wrong"). I don't know what file should be changed to support my convention, but I opened a uservoice ticket for that, as suggested in the answer to question #30057721
– Guss
May 7 '15 at 9:49
3
3
Is there also an option to set the default for new, blank files? There's not much to guess in that scenario and I think VSCode will default to using spaces (which I don't prefer)...
– Stijn de Witt
Oct 7 '16 at 12:43
Is there also an option to set the default for new, blank files? There's not much to guess in that scenario and I think VSCode will default to using spaces (which I don't prefer)...
– Stijn de Witt
Oct 7 '16 at 12:43
3
3
This did not work when i tried it with a .json file.
– arcseldon
Oct 12 '16 at 12:32
This did not work when i tried it with a .json file.
– arcseldon
Oct 12 '16 at 12:32
5
5
Adding ` "editor.detectIndentation": false` worked in my case.
– arcseldon
Oct 12 '16 at 12:36
Adding ` "editor.detectIndentation": false` worked in my case.
– arcseldon
Oct 12 '16 at 12:36
2
2
If you have the "prettier" extension installed, make sure to also set the prettier.tabWidth value to 4. I just ran in to this today. :)
– Jamie Nordmeyer
Aug 14 '18 at 19:28
If you have the "prettier" extension installed, make sure to also set the prettier.tabWidth value to 4. I just ran in to this today. :)
– Jamie Nordmeyer
Aug 14 '18 at 19:28
|
show 9 more comments
I'm running version 1.21 but I think this may apply to earlier versions as well.
Take a look at the bottom right-hand side of the screen. You should see something that says Spaces
or Tab-Size
.
Mine shows spaces, -->
- Click on the
Spaces
(orTab-Size
) - Choose
Indent Using Spaces
orIndent using Tabs
- Select the amount of spaces or tabs you like.
This only works per document, not project-wide. If you want to apply it project-wide, you need to also add "editor.detectIndentation": false
to your user settings.
3
nice. just need to right click on the file then choose format code to do the conversion.
– Meirion Hughes
Aug 18 '16 at 11:09
7
Much clearer solution than the accepted answer. I could not even edit the file in the accepted answer. This actually worked.
– DarthOpto
Nov 8 '16 at 16:41
I'm using VS Code on Windows. Using the tab indicator on the status bar method to change tab settings works for most files but is not working in .cshtml files? Can anyone confirm?
– Darren Evans
Apr 12 '17 at 12:40
1
VSCode warns now ifeditor.detectIndentation
is set totrue
and you change theeditor.tabSize
. However, since the GUI forsettings.json
oruser-settings.json
it's easier to change this now.
– chriszo111
Nov 15 '18 at 14:13
add a comment |
I'm running version 1.21 but I think this may apply to earlier versions as well.
Take a look at the bottom right-hand side of the screen. You should see something that says Spaces
or Tab-Size
.
Mine shows spaces, -->
- Click on the
Spaces
(orTab-Size
) - Choose
Indent Using Spaces
orIndent using Tabs
- Select the amount of spaces or tabs you like.
This only works per document, not project-wide. If you want to apply it project-wide, you need to also add "editor.detectIndentation": false
to your user settings.
3
nice. just need to right click on the file then choose format code to do the conversion.
– Meirion Hughes
Aug 18 '16 at 11:09
7
Much clearer solution than the accepted answer. I could not even edit the file in the accepted answer. This actually worked.
– DarthOpto
Nov 8 '16 at 16:41
I'm using VS Code on Windows. Using the tab indicator on the status bar method to change tab settings works for most files but is not working in .cshtml files? Can anyone confirm?
– Darren Evans
Apr 12 '17 at 12:40
1
VSCode warns now ifeditor.detectIndentation
is set totrue
and you change theeditor.tabSize
. However, since the GUI forsettings.json
oruser-settings.json
it's easier to change this now.
– chriszo111
Nov 15 '18 at 14:13
add a comment |
I'm running version 1.21 but I think this may apply to earlier versions as well.
Take a look at the bottom right-hand side of the screen. You should see something that says Spaces
or Tab-Size
.
Mine shows spaces, -->
- Click on the
Spaces
(orTab-Size
) - Choose
Indent Using Spaces
orIndent using Tabs
- Select the amount of spaces or tabs you like.
This only works per document, not project-wide. If you want to apply it project-wide, you need to also add "editor.detectIndentation": false
to your user settings.
I'm running version 1.21 but I think this may apply to earlier versions as well.
Take a look at the bottom right-hand side of the screen. You should see something that says Spaces
or Tab-Size
.
Mine shows spaces, -->
- Click on the
Spaces
(orTab-Size
) - Choose
Indent Using Spaces
orIndent using Tabs
- Select the amount of spaces or tabs you like.
This only works per document, not project-wide. If you want to apply it project-wide, you need to also add "editor.detectIndentation": false
to your user settings.
edited Apr 4 '18 at 10:22
shiri
620622
620622
answered Jun 28 '16 at 18:18
TrickyTricky
5,7111109
5,7111109
3
nice. just need to right click on the file then choose format code to do the conversion.
– Meirion Hughes
Aug 18 '16 at 11:09
7
Much clearer solution than the accepted answer. I could not even edit the file in the accepted answer. This actually worked.
– DarthOpto
Nov 8 '16 at 16:41
I'm using VS Code on Windows. Using the tab indicator on the status bar method to change tab settings works for most files but is not working in .cshtml files? Can anyone confirm?
– Darren Evans
Apr 12 '17 at 12:40
1
VSCode warns now ifeditor.detectIndentation
is set totrue
and you change theeditor.tabSize
. However, since the GUI forsettings.json
oruser-settings.json
it's easier to change this now.
– chriszo111
Nov 15 '18 at 14:13
add a comment |
3
nice. just need to right click on the file then choose format code to do the conversion.
– Meirion Hughes
Aug 18 '16 at 11:09
7
Much clearer solution than the accepted answer. I could not even edit the file in the accepted answer. This actually worked.
– DarthOpto
Nov 8 '16 at 16:41
I'm using VS Code on Windows. Using the tab indicator on the status bar method to change tab settings works for most files but is not working in .cshtml files? Can anyone confirm?
– Darren Evans
Apr 12 '17 at 12:40
1
VSCode warns now ifeditor.detectIndentation
is set totrue
and you change theeditor.tabSize
. However, since the GUI forsettings.json
oruser-settings.json
it's easier to change this now.
– chriszo111
Nov 15 '18 at 14:13
3
3
nice. just need to right click on the file then choose format code to do the conversion.
– Meirion Hughes
Aug 18 '16 at 11:09
nice. just need to right click on the file then choose format code to do the conversion.
– Meirion Hughes
Aug 18 '16 at 11:09
7
7
Much clearer solution than the accepted answer. I could not even edit the file in the accepted answer. This actually worked.
– DarthOpto
Nov 8 '16 at 16:41
Much clearer solution than the accepted answer. I could not even edit the file in the accepted answer. This actually worked.
– DarthOpto
Nov 8 '16 at 16:41
I'm using VS Code on Windows. Using the tab indicator on the status bar method to change tab settings works for most files but is not working in .cshtml files? Can anyone confirm?
– Darren Evans
Apr 12 '17 at 12:40
I'm using VS Code on Windows. Using the tab indicator on the status bar method to change tab settings works for most files but is not working in .cshtml files? Can anyone confirm?
– Darren Evans
Apr 12 '17 at 12:40
1
1
VSCode warns now if
editor.detectIndentation
is set to true
and you change the editor.tabSize
. However, since the GUI for settings.json
or user-settings.json
it's easier to change this now.– chriszo111
Nov 15 '18 at 14:13
VSCode warns now if
editor.detectIndentation
is set to true
and you change the editor.tabSize
. However, since the GUI for settings.json
or user-settings.json
it's easier to change this now.– chriszo111
Nov 15 '18 at 14:13
add a comment |
Well, the new version of Visual Studio Code allows you to specify differently file type for the tabSize. Here is the example of my settings.json
with default 4 spaces and JavaScript/JSON 2 spaces:
// I want my default to be 4, but JS/JSON to be 2
"editor.tabSize": 4,
"[javascript]":
"editor.tabSize": 2
,
"[json]":
"editor.tabSize": 2
PS: Well, if you do not know how to open this file, you can: click left-bottom gear -> then settings
9
Beautiful. It works! Some quick addition to that, the thing between the brackets, if you look at the lower right corner of visual studio, you can spot the name to use! Check it out: tinypic.com/m/jr9nw1/3
– Jose A
Oct 6 '17 at 13:17
add a comment |
Well, the new version of Visual Studio Code allows you to specify differently file type for the tabSize. Here is the example of my settings.json
with default 4 spaces and JavaScript/JSON 2 spaces:
// I want my default to be 4, but JS/JSON to be 2
"editor.tabSize": 4,
"[javascript]":
"editor.tabSize": 2
,
"[json]":
"editor.tabSize": 2
PS: Well, if you do not know how to open this file, you can: click left-bottom gear -> then settings
9
Beautiful. It works! Some quick addition to that, the thing between the brackets, if you look at the lower right corner of visual studio, you can spot the name to use! Check it out: tinypic.com/m/jr9nw1/3
– Jose A
Oct 6 '17 at 13:17
add a comment |
Well, the new version of Visual Studio Code allows you to specify differently file type for the tabSize. Here is the example of my settings.json
with default 4 spaces and JavaScript/JSON 2 spaces:
// I want my default to be 4, but JS/JSON to be 2
"editor.tabSize": 4,
"[javascript]":
"editor.tabSize": 2
,
"[json]":
"editor.tabSize": 2
PS: Well, if you do not know how to open this file, you can: click left-bottom gear -> then settings
Well, the new version of Visual Studio Code allows you to specify differently file type for the tabSize. Here is the example of my settings.json
with default 4 spaces and JavaScript/JSON 2 spaces:
// I want my default to be 4, but JS/JSON to be 2
"editor.tabSize": 4,
"[javascript]":
"editor.tabSize": 2
,
"[json]":
"editor.tabSize": 2
PS: Well, if you do not know how to open this file, you can: click left-bottom gear -> then settings
edited Dec 18 '18 at 0:15
answered May 10 '17 at 3:28
XinXin
7,87944047
7,87944047
9
Beautiful. It works! Some quick addition to that, the thing between the brackets, if you look at the lower right corner of visual studio, you can spot the name to use! Check it out: tinypic.com/m/jr9nw1/3
– Jose A
Oct 6 '17 at 13:17
add a comment |
9
Beautiful. It works! Some quick addition to that, the thing between the brackets, if you look at the lower right corner of visual studio, you can spot the name to use! Check it out: tinypic.com/m/jr9nw1/3
– Jose A
Oct 6 '17 at 13:17
9
9
Beautiful. It works! Some quick addition to that, the thing between the brackets, if you look at the lower right corner of visual studio, you can spot the name to use! Check it out: tinypic.com/m/jr9nw1/3
– Jose A
Oct 6 '17 at 13:17
Beautiful. It works! Some quick addition to that, the thing between the brackets, if you look at the lower right corner of visual studio, you can spot the name to use! Check it out: tinypic.com/m/jr9nw1/3
– Jose A
Oct 6 '17 at 13:17
add a comment |
By default, Visual Studio Code auto-detects the indentation of the current open file. If you want to switch this feature off and make all indentation, for example, two spaces, you'd do the following in your User Settings or Workspace settings.
"editor.tabSize": 2,
"editor.detectIndentation": false
2
And if you want to leave "editor.detectIdentation": true, but still change the identation from spaces to tabs, you need to remove all identation in your file, save and close it, then reopen and do Format document.
– LoBo
May 26 '17 at 14:48
...why would you do that? Can't you just use the convert indentation command?
– celticminstrel
Aug 6 '18 at 16:04
add a comment |
By default, Visual Studio Code auto-detects the indentation of the current open file. If you want to switch this feature off and make all indentation, for example, two spaces, you'd do the following in your User Settings or Workspace settings.
"editor.tabSize": 2,
"editor.detectIndentation": false
2
And if you want to leave "editor.detectIdentation": true, but still change the identation from spaces to tabs, you need to remove all identation in your file, save and close it, then reopen and do Format document.
– LoBo
May 26 '17 at 14:48
...why would you do that? Can't you just use the convert indentation command?
– celticminstrel
Aug 6 '18 at 16:04
add a comment |
By default, Visual Studio Code auto-detects the indentation of the current open file. If you want to switch this feature off and make all indentation, for example, two spaces, you'd do the following in your User Settings or Workspace settings.
"editor.tabSize": 2,
"editor.detectIndentation": false
By default, Visual Studio Code auto-detects the indentation of the current open file. If you want to switch this feature off and make all indentation, for example, two spaces, you'd do the following in your User Settings or Workspace settings.
"editor.tabSize": 2,
"editor.detectIndentation": false
edited Dec 15 '18 at 18:00
Peter Mortensen
14k1987114
14k1987114
answered Aug 8 '16 at 13:32
Jim DoyleJim Doyle
1,348177
1,348177
2
And if you want to leave "editor.detectIdentation": true, but still change the identation from spaces to tabs, you need to remove all identation in your file, save and close it, then reopen and do Format document.
– LoBo
May 26 '17 at 14:48
...why would you do that? Can't you just use the convert indentation command?
– celticminstrel
Aug 6 '18 at 16:04
add a comment |
2
And if you want to leave "editor.detectIdentation": true, but still change the identation from spaces to tabs, you need to remove all identation in your file, save and close it, then reopen and do Format document.
– LoBo
May 26 '17 at 14:48
...why would you do that? Can't you just use the convert indentation command?
– celticminstrel
Aug 6 '18 at 16:04
2
2
And if you want to leave "editor.detectIdentation": true, but still change the identation from spaces to tabs, you need to remove all identation in your file, save and close it, then reopen and do Format document.
– LoBo
May 26 '17 at 14:48
And if you want to leave "editor.detectIdentation": true, but still change the identation from spaces to tabs, you need to remove all identation in your file, save and close it, then reopen and do Format document.
– LoBo
May 26 '17 at 14:48
...why would you do that? Can't you just use the convert indentation command?
– celticminstrel
Aug 6 '18 at 16:04
...why would you do that? Can't you just use the convert indentation command?
– celticminstrel
Aug 6 '18 at 16:04
add a comment |
We can control tab size by file type with EditorConfig and its Visual Studio Code extension. We then can make Alt + Shift + F specific to each file type.
Installation
ext install EditorConfig
Example Configuration
.editorconfig
[*]
indent_style = space
[*.cs,js]
indent_size = 4
[*.json]
indent_size = 2
settings.json
EditorConfig overrides whatever settings.json configures for the editor. There is no need to change editor.detectIndentation
.
add a comment |
We can control tab size by file type with EditorConfig and its Visual Studio Code extension. We then can make Alt + Shift + F specific to each file type.
Installation
ext install EditorConfig
Example Configuration
.editorconfig
[*]
indent_style = space
[*.cs,js]
indent_size = 4
[*.json]
indent_size = 2
settings.json
EditorConfig overrides whatever settings.json configures for the editor. There is no need to change editor.detectIndentation
.
add a comment |
We can control tab size by file type with EditorConfig and its Visual Studio Code extension. We then can make Alt + Shift + F specific to each file type.
Installation
ext install EditorConfig
Example Configuration
.editorconfig
[*]
indent_style = space
[*.cs,js]
indent_size = 4
[*.json]
indent_size = 2
settings.json
EditorConfig overrides whatever settings.json configures for the editor. There is no need to change editor.detectIndentation
.
We can control tab size by file type with EditorConfig and its Visual Studio Code extension. We then can make Alt + Shift + F specific to each file type.
Installation
ext install EditorConfig
Example Configuration
.editorconfig
[*]
indent_style = space
[*.cs,js]
indent_size = 4
[*.json]
indent_size = 2
settings.json
EditorConfig overrides whatever settings.json configures for the editor. There is no need to change editor.detectIndentation
.
edited Dec 15 '18 at 18:01
Peter Mortensen
14k1987114
14k1987114
answered Sep 9 '16 at 2:35
Shaun LuttinShaun Luttin
63.5k36239299
63.5k36239299
add a comment |
add a comment |
You want to make sure your editorconfig is not conflicting with your user or workspace settings configuration, as I just had a bit of annoyance thinking the settings files settings were not being applied when it was my editor configuration undoing those changes.
add a comment |
You want to make sure your editorconfig is not conflicting with your user or workspace settings configuration, as I just had a bit of annoyance thinking the settings files settings were not being applied when it was my editor configuration undoing those changes.
add a comment |
You want to make sure your editorconfig is not conflicting with your user or workspace settings configuration, as I just had a bit of annoyance thinking the settings files settings were not being applied when it was my editor configuration undoing those changes.
You want to make sure your editorconfig is not conflicting with your user or workspace settings configuration, as I just had a bit of annoyance thinking the settings files settings were not being applied when it was my editor configuration undoing those changes.
edited Dec 15 '18 at 18:02
Peter Mortensen
14k1987114
14k1987114
answered Mar 22 '17 at 16:22
Travis BrownTravis Brown
6618
6618
add a comment |
add a comment |
That is lonefy.vscode-js-css-html-formatter
to blame. Disable it, and install HookyQR.beautify
.
Now on save your tabs wouldn't be converted.
add a comment |
That is lonefy.vscode-js-css-html-formatter
to blame. Disable it, and install HookyQR.beautify
.
Now on save your tabs wouldn't be converted.
add a comment |
That is lonefy.vscode-js-css-html-formatter
to blame. Disable it, and install HookyQR.beautify
.
Now on save your tabs wouldn't be converted.
That is lonefy.vscode-js-css-html-formatter
to blame. Disable it, and install HookyQR.beautify
.
Now on save your tabs wouldn't be converted.
edited Dec 15 '18 at 18:05
Peter Mortensen
14k1987114
14k1987114
answered Jul 4 '17 at 22:03
user3550138user3550138
9112
9112
add a comment |
add a comment |
In VSC version 1.31.1
or more (I think).
Like sed Alex Dima.
You can customize this easily via these settings for
- Windows in menu File → Preferences → User Settings or use short keys
ctr + shift + p
- Mac in menu Code → Preferences → Settings or ⌘,
add a comment |
In VSC version 1.31.1
or more (I think).
Like sed Alex Dima.
You can customize this easily via these settings for
- Windows in menu File → Preferences → User Settings or use short keys
ctr + shift + p
- Mac in menu Code → Preferences → Settings or ⌘,
add a comment |
In VSC version 1.31.1
or more (I think).
Like sed Alex Dima.
You can customize this easily via these settings for
- Windows in menu File → Preferences → User Settings or use short keys
ctr + shift + p
- Mac in menu Code → Preferences → Settings or ⌘,
In VSC version 1.31.1
or more (I think).
Like sed Alex Dima.
You can customize this easily via these settings for
- Windows in menu File → Preferences → User Settings or use short keys
ctr + shift + p
- Mac in menu Code → Preferences → Settings or ⌘,
answered Feb 16 at 12:47
Andrey PatseikoAndrey Patseiko
35437
35437
add a comment |
add a comment |
If you use the prettier extension in vscode, try adding this to the settings.json file:
"editor.insertSpaces": false,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"prettier.tabWidth": 4,
"prettier.useTabs": true // this made it finally work for me
add a comment |
If you use the prettier extension in vscode, try adding this to the settings.json file:
"editor.insertSpaces": false,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"prettier.tabWidth": 4,
"prettier.useTabs": true // this made it finally work for me
add a comment |
If you use the prettier extension in vscode, try adding this to the settings.json file:
"editor.insertSpaces": false,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"prettier.tabWidth": 4,
"prettier.useTabs": true // this made it finally work for me
If you use the prettier extension in vscode, try adding this to the settings.json file:
"editor.insertSpaces": false,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"prettier.tabWidth": 4,
"prettier.useTabs": true // this made it finally work for me
answered Feb 23 at 20:04
slowpoke123slowpoke123
709
709
add a comment |
add a comment |
In your bottom-right corner, you have Spaces:
Spaces: 2
There you can change the indentation according to your needs:
Indentation Options
add a comment |
In your bottom-right corner, you have Spaces:
Spaces: 2
There you can change the indentation according to your needs:
Indentation Options
add a comment |
In your bottom-right corner, you have Spaces:
Spaces: 2
There you can change the indentation according to your needs:
Indentation Options
In your bottom-right corner, you have Spaces:
Spaces: 2
There you can change the indentation according to your needs:
Indentation Options
answered Mar 22 at 13:33
DacomisDacomis
314
314
add a comment |
add a comment |
If the accepted answer on this post doesn't work, give this a try:
I had EditorConfig for Visual Studio Code installed in my editor, and it kept overriding my user settings which were set to indent files using spaces. Every time I switched between editor tabs, my file would automatically get indented with tabs even if I had converted indentation to spaces!!!
Right after I uninstalled this extension, indentation no longer changes between switching editor tabs, and I can work more comfortably rather than having to manually convert tabs to spaces every time I switch files - that is painful.
this was it for me.no matter how i changed my settings, every time i opened the file it would revert.
– Esteban
Feb 20 at 20:12
add a comment |
If the accepted answer on this post doesn't work, give this a try:
I had EditorConfig for Visual Studio Code installed in my editor, and it kept overriding my user settings which were set to indent files using spaces. Every time I switched between editor tabs, my file would automatically get indented with tabs even if I had converted indentation to spaces!!!
Right after I uninstalled this extension, indentation no longer changes between switching editor tabs, and I can work more comfortably rather than having to manually convert tabs to spaces every time I switch files - that is painful.
this was it for me.no matter how i changed my settings, every time i opened the file it would revert.
– Esteban
Feb 20 at 20:12
add a comment |
If the accepted answer on this post doesn't work, give this a try:
I had EditorConfig for Visual Studio Code installed in my editor, and it kept overriding my user settings which were set to indent files using spaces. Every time I switched between editor tabs, my file would automatically get indented with tabs even if I had converted indentation to spaces!!!
Right after I uninstalled this extension, indentation no longer changes between switching editor tabs, and I can work more comfortably rather than having to manually convert tabs to spaces every time I switch files - that is painful.
If the accepted answer on this post doesn't work, give this a try:
I had EditorConfig for Visual Studio Code installed in my editor, and it kept overriding my user settings which were set to indent files using spaces. Every time I switched between editor tabs, my file would automatically get indented with tabs even if I had converted indentation to spaces!!!
Right after I uninstalled this extension, indentation no longer changes between switching editor tabs, and I can work more comfortably rather than having to manually convert tabs to spaces every time I switch files - that is painful.
edited Dec 15 '18 at 18:11
Peter Mortensen
14k1987114
14k1987114
answered Jul 25 '18 at 23:16
dhruvpateldhruvpatel
7511823
7511823
this was it for me.no matter how i changed my settings, every time i opened the file it would revert.
– Esteban
Feb 20 at 20:12
add a comment |
this was it for me.no matter how i changed my settings, every time i opened the file it would revert.
– Esteban
Feb 20 at 20:12
this was it for me.no matter how i changed my settings, every time i opened the file it would revert.
– Esteban
Feb 20 at 20:12
this was it for me.no matter how i changed my settings, every time i opened the file it would revert.
– Esteban
Feb 20 at 20:12
add a comment |
@alex-dima's solution from 2015 will change tab sizes and spaces for all files and @Tricky's solution from 2016 appears to only change the settings for the current file.
As of 2017, I found another solution that works on a per-language basis. Visual Studio Code was not using the proper tab sizes or space settings for Elixir, so I found that I could change the settings for all Elixir files.
I clicked on the language in the status bar ("Elixir" in my case), chose "Configure 'Elixir' language based settings...", and edited the Elixir-specific language settings. I just copied the "editor.tabSize" and "editor.insertSpaces" settings from the default settings on the left (I'm so glad those are shown) and then modified them on the right.
It worked great, and now all Elixir language files use the proper tab size and space settings.
add a comment |
@alex-dima's solution from 2015 will change tab sizes and spaces for all files and @Tricky's solution from 2016 appears to only change the settings for the current file.
As of 2017, I found another solution that works on a per-language basis. Visual Studio Code was not using the proper tab sizes or space settings for Elixir, so I found that I could change the settings for all Elixir files.
I clicked on the language in the status bar ("Elixir" in my case), chose "Configure 'Elixir' language based settings...", and edited the Elixir-specific language settings. I just copied the "editor.tabSize" and "editor.insertSpaces" settings from the default settings on the left (I'm so glad those are shown) and then modified them on the right.
It worked great, and now all Elixir language files use the proper tab size and space settings.
add a comment |
@alex-dima's solution from 2015 will change tab sizes and spaces for all files and @Tricky's solution from 2016 appears to only change the settings for the current file.
As of 2017, I found another solution that works on a per-language basis. Visual Studio Code was not using the proper tab sizes or space settings for Elixir, so I found that I could change the settings for all Elixir files.
I clicked on the language in the status bar ("Elixir" in my case), chose "Configure 'Elixir' language based settings...", and edited the Elixir-specific language settings. I just copied the "editor.tabSize" and "editor.insertSpaces" settings from the default settings on the left (I'm so glad those are shown) and then modified them on the right.
It worked great, and now all Elixir language files use the proper tab size and space settings.
@alex-dima's solution from 2015 will change tab sizes and spaces for all files and @Tricky's solution from 2016 appears to only change the settings for the current file.
As of 2017, I found another solution that works on a per-language basis. Visual Studio Code was not using the proper tab sizes or space settings for Elixir, so I found that I could change the settings for all Elixir files.
I clicked on the language in the status bar ("Elixir" in my case), chose "Configure 'Elixir' language based settings...", and edited the Elixir-specific language settings. I just copied the "editor.tabSize" and "editor.insertSpaces" settings from the default settings on the left (I'm so glad those are shown) and then modified them on the right.
It worked great, and now all Elixir language files use the proper tab size and space settings.
answered Nov 29 '17 at 23:16
Kevin PeterKevin Peter
23645
23645
add a comment |
add a comment |
Menu File → Preferences → Settings
Add to user settings:
"editor.tabSize": 2,
"editor.detectIndentation": false
then right click your document if you have one opened already and click Format Document to have your existing document follow these new settings.
add a comment |
Menu File → Preferences → Settings
Add to user settings:
"editor.tabSize": 2,
"editor.detectIndentation": false
then right click your document if you have one opened already and click Format Document to have your existing document follow these new settings.
add a comment |
Menu File → Preferences → Settings
Add to user settings:
"editor.tabSize": 2,
"editor.detectIndentation": false
then right click your document if you have one opened already and click Format Document to have your existing document follow these new settings.
Menu File → Preferences → Settings
Add to user settings:
"editor.tabSize": 2,
"editor.detectIndentation": false
then right click your document if you have one opened already and click Format Document to have your existing document follow these new settings.
edited Dec 15 '18 at 18:08
Peter Mortensen
14k1987114
14k1987114
answered Jan 24 '18 at 20:39
Gmoney MozartGmoney Mozart
311
311
add a comment |
add a comment |
When using TypeScript, the default tab width is always two regardless of what it says in the toolbar. You have to set "prettier.tabWidth" in your user settings to change it.
Ctrl + P, Type → user settings, add:
"prettier.tabWidth": 4
add a comment |
When using TypeScript, the default tab width is always two regardless of what it says in the toolbar. You have to set "prettier.tabWidth" in your user settings to change it.
Ctrl + P, Type → user settings, add:
"prettier.tabWidth": 4
add a comment |
When using TypeScript, the default tab width is always two regardless of what it says in the toolbar. You have to set "prettier.tabWidth" in your user settings to change it.
Ctrl + P, Type → user settings, add:
"prettier.tabWidth": 4
When using TypeScript, the default tab width is always two regardless of what it says in the toolbar. You have to set "prettier.tabWidth" in your user settings to change it.
Ctrl + P, Type → user settings, add:
"prettier.tabWidth": 4
edited Dec 15 '18 at 18:10
Peter Mortensen
14k1987114
14k1987114
answered Jul 12 '18 at 15:16
Steve HanovSteve Hanov
5,911154859
5,911154859
add a comment |
add a comment |
User3550138 is correct. lonefy.vscode-js-css-html-formatter
overrides all the settings mentioned in other answers. However, you don't have to disable or uninstall it as it can be configured.
Full instructions can be found by opening the extensions sidebar and clicking on this extension and it will display configuration instructions in the editor workspace. At least it does for me in Visual Studio Code version 1.14.1.
add a comment |
User3550138 is correct. lonefy.vscode-js-css-html-formatter
overrides all the settings mentioned in other answers. However, you don't have to disable or uninstall it as it can be configured.
Full instructions can be found by opening the extensions sidebar and clicking on this extension and it will display configuration instructions in the editor workspace. At least it does for me in Visual Studio Code version 1.14.1.
add a comment |
User3550138 is correct. lonefy.vscode-js-css-html-formatter
overrides all the settings mentioned in other answers. However, you don't have to disable or uninstall it as it can be configured.
Full instructions can be found by opening the extensions sidebar and clicking on this extension and it will display configuration instructions in the editor workspace. At least it does for me in Visual Studio Code version 1.14.1.
User3550138 is correct. lonefy.vscode-js-css-html-formatter
overrides all the settings mentioned in other answers. However, you don't have to disable or uninstall it as it can be configured.
Full instructions can be found by opening the extensions sidebar and clicking on this extension and it will display configuration instructions in the editor workspace. At least it does for me in Visual Studio Code version 1.14.1.
edited Dec 15 '18 at 18:06
Peter Mortensen
14k1987114
14k1987114
answered Jul 15 '17 at 1:12
DRLDRL
11
11
add a comment |
add a comment |
If this is for Angular 2, and the CLI is generating files which you would like differently formatted, you can edit these files to change what is generated:
npm_modules/@angular/cli/blueprints/component/files/__path__/*
Not massively recommended as an npm update will delete your work, but it has saved me a lot of time.
add a comment |
If this is for Angular 2, and the CLI is generating files which you would like differently formatted, you can edit these files to change what is generated:
npm_modules/@angular/cli/blueprints/component/files/__path__/*
Not massively recommended as an npm update will delete your work, but it has saved me a lot of time.
add a comment |
If this is for Angular 2, and the CLI is generating files which you would like differently formatted, you can edit these files to change what is generated:
npm_modules/@angular/cli/blueprints/component/files/__path__/*
Not massively recommended as an npm update will delete your work, but it has saved me a lot of time.
If this is for Angular 2, and the CLI is generating files which you would like differently formatted, you can edit these files to change what is generated:
npm_modules/@angular/cli/blueprints/component/files/__path__/*
Not massively recommended as an npm update will delete your work, but it has saved me a lot of time.
edited Dec 15 '18 at 18:07
Peter Mortensen
14k1987114
14k1987114
answered Sep 29 '17 at 12:53
Ben TaliadorosBen Taliadoros
3,163114575
3,163114575
add a comment |
add a comment |
I tried to change editor.tabSize
to 4, but .editorConfig
overrides whatever settings I had specified, so there is no need to change any configuration in user settings. You just need to edit .editorConfig file:
set indent_size = 4
add a comment |
I tried to change editor.tabSize
to 4, but .editorConfig
overrides whatever settings I had specified, so there is no need to change any configuration in user settings. You just need to edit .editorConfig file:
set indent_size = 4
add a comment |
I tried to change editor.tabSize
to 4, but .editorConfig
overrides whatever settings I had specified, so there is no need to change any configuration in user settings. You just need to edit .editorConfig file:
set indent_size = 4
I tried to change editor.tabSize
to 4, but .editorConfig
overrides whatever settings I had specified, so there is no need to change any configuration in user settings. You just need to edit .editorConfig file:
set indent_size = 4
edited Dec 15 '18 at 18:09
Peter Mortensen
14k1987114
14k1987114
answered Jun 8 '18 at 13:32
Gh111Gh111
24754
24754
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29972396%2fhow-to-customize-the-tab-to-space-conversion-factor-when-using-visual-studio-cod%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown