6

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
}
1
  • As oyu obviously ;-) want to use your tab style for COBOL fixed-form reference-format: github.com/spgennard/vscode_cobol has at least no issue concerning tabs - if you don't use it maybe give it a try and if you use hte latest version create an issue for this topic. Nov 29, 2017 at 18:37

1 Answer 1

27

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.

enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.