简体   繁体   中英

have different tab sizes in visual studio code

I'm using visual studio code for programming cobol. However i would like to be able to set different tab sizes for the first and second tabs and then change the size to 3 spaces after that. However i don't know how i can set it like that. This is how i would like it set.

first tab = 7 spaces.
2nd tab = 1 space.
3th tab = 4 spaces.
4th and ongoing = 3 spaces.

I found how to set it to 3 spaces for all my tabs. These are my current self set settings.

{
    "editor.tabSize": 3,
    "editor.detectIndentation": false,
    // Insert spaces when pressing Tab. This setting is overriden
    // based on the file contents when `editor.detectIndentation` is true.
    "editor.insertSpaces": true
}

You can manually set your indentation on open files using the toolbar at the bottom right (see image below) however this will not persist to whenever you change your tabs order, this is file specific.

From there on VSC has a "editor.detectIndentation" settings variable default to true that will help you keep your indentation working.

在此输入图像描述

You can even set default tab sizes per file-type by adding something like this to your settings:

{
    "[sass]": {
        "editor.tabSize": 2
    },
    "[html]": {
        "editor.tabSize": 4
    },
    "[javascript]": {
        "editor.tabSize": 2
    }
}

However, for you request I'm afraid the answer is no, you can't do this on a way that will persist based on the order of your tabs only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM