How can I use a tsconfig file that isn't named "tsconfig.json" in VS Code?
Asked Answered
E

1

10

I want to use a custom tsconfig named "tsconfig.custom.json" in VS Code, but it seems that it only recognizes tsconfig files named "tsconfig.json". Is there a way to change that?

Earthlight answered 29/3, 2018 at 11:59 Comment(2)
Not unless something has changed recently. This was explicitly not supported when the question came up on GitHub around 2 months ago. Just flip your files and put the settings you wish the IDE to respect in the default one.Weathercock
yes, you are right. According to this github.com/Microsoft/vscode/issues/12463 it seems that it's in progressEarthlight
D
4

As already mentioned in the comments, at the time of this writing, there isn't full support for tsconfig files named anything other than "tsconfig.json" in VS Code yet. See this issue on the VS Code GitHub repo: Allow to specify the tsconfig.json filename explicitly #12463. fun note: see the end of the thread to learn why you shouldn't pester project maintainers with non-constructive "me too" comments in their issue tickets :P

You can, however, at least get autocomplete for filling in fields by telling VS Code what JSON schema to use for the file. Use the json.schemas setting like so:

"json.schemas": [
    {
        "fileMatch": [ "*tsconfig*.json" ],
        "url": "http://json.schemastore.org/tsconfig",
    }
],

Adjust the glob pattern as needed.

And if your top-level tsconfig is named tsconfig.json and it extends other tsconfigs not named "tsconfig.json", support for IntelliSense based on the inherited config settings should work fine (I'm pretty sure the reason is because that functionality is handled by ts-server and not directly by VS Code).

Delgadillo answered 13/2, 2023 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.