Prettier-vscode: [typescript] Format Document is ignoring editor.tabSize (and .eslintrc and tslint.json)

Created on 27 Jun 2017  路  7Comments  路  Source: prettier/prettier-vscode

It seems as though the typescript formatting is ignoring editor.tabSize and always formatting with a tab size of 2.

I made a recording to demonstrate the issue (in this recording I have every plugin except for prettier disabled):

http://imgur.com/a/MBs5b

If I disable prettier-vscode, then the file gets formatted correctly with an indent of 4.

locked

Most helpful comment

Considering that prettier now supports more than just JS, it'd be wise to support editor.tabSize as VSCode supports language-based editor.tabSize, as in:

    "[js]": {
        "editor.tabSize": 2
    },
    "[json]": {
        "editor.tabSize": 4
    }

All 7 comments

The setting is prettier.tabWidth (default: 2)
We are inferring from eslintrc only with eslintIntegration and on JS files.

any particular reason not to infer from either .editorconfig or tslint.json?

For tslint, see prettier/prettier-eslint#92

For editorconfig, see #81

I may want at some point to support editor.tabSize & editor.insertSpace
This was not done before as prettier wasn't supporting tabs. And now we have those settings.

Considering that prettier now supports more than just JS, it'd be wise to support editor.tabSize as VSCode supports language-based editor.tabSize, as in:

    "[js]": {
        "editor.tabSize": 2
    },
    "[json]": {
        "editor.tabSize": 4
    }

@flagello that's a great solution.
There still is the trouble with printWidth / trailingComma we also want to support. see #130

Closing as the initial post has been replied

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings