You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow tsserver to find and use tsconfig.json's not named "tsconfig.json", and choose between multiple tsconfig.json's in a directory if there's more than one (e.g. tsconfig.test.json, tsconfig.src.json)
This is similar to #32039 but not quite the same (I don't think that issue includes supporting use of multiple tsconfig.json's in a directory)
🔍 Search Terms
tsserver
tsconfig.json
✅ Viability Checklist
My suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
Today, tsserver seems to search specifically for the nearest tsconfig.json file. It'd be helpful if it could search for files named tsconfig*.json, and if there are multiple in the same directory then use their include/exclude settings to determine which to use for the opened file.
📃 Motivating Example
A common preference amongst devs at our company is to co-locate source files and test files in the same directory, e.g.:
design_system/
button.ts
button_test.ts
This makes it easy to see at a glance which src files are covered by tests and find the corresponding tests, and VSCode's new file nesting feature supports this setup nicely.
However, this does not play nicely with VSCode's built-in TS language service since tsserver looks specifically for the nearest file named tsconfig.json. If we were to add separate tsconfig.json's for tests vs source files (in case we wanted different compilation settings), and our directory looked like:
design_system/
button.ts
button_test.ts
tsconfig.json
tsconfig.test.json
tsserver would only find tsconfig.json and not tsconfig.test.json
💻 Use Cases
What do you want to use this for?
Enabling correct editor intellisense when co-locating the configuration for multiple related projects in the same directory
What workarounds are you using in the meantime?
Use a single tsconfig.json for all files in the directory for the editor, and generate separate ones on-the-fly at build time
The text was updated successfully, but these errors were encountered:
Oops 🤦♀️ that's actually the one I meant to link in the description when I wrote:
This is similar to #32039 but not quite the same (I don't think that issue includes supporting use of multiple tsconfig.json's in a directory)
Must've copy/pasted the wrong open tab's url!
I don't think just allowing us to configure using specific tsconfig.json's would solve our use case. e.g. if we configured tsserver to use files named tsconfig.src.json and tsconfig.test.json's, for a file in the same directory as both tsconfig.*.json's it would still have to determine which one to use for button.ts vs button_test.ts
Suggestion
Allow tsserver to find and use tsconfig.json's not named "tsconfig.json", and choose between multiple tsconfig.json's in a directory if there's more than one (e.g. tsconfig.test.json, tsconfig.src.json)
This is similar to #32039 but not quite the same (I don't think that issue includes supporting use of multiple tsconfig.json's in a directory)
🔍 Search Terms
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Today, tsserver seems to search specifically for the nearest
tsconfig.json
file. It'd be helpful if it could search for files namedtsconfig*.json
, and if there are multiple in the same directory then use their include/exclude settings to determine which to use for the opened file.📃 Motivating Example
A common preference amongst devs at our company is to co-locate source files and test files in the same directory, e.g.:
This makes it easy to see at a glance which src files are covered by tests and find the corresponding tests, and VSCode's new file nesting feature supports this setup nicely.
However, this does not play nicely with VSCode's built-in TS language service since tsserver looks specifically for the nearest file named
tsconfig.json
. If we were to add separate tsconfig.json's for tests vs source files (in case we wanted different compilation settings), and our directory looked like:tsserver would only find tsconfig.json and not tsconfig.test.json
💻 Use Cases
What do you want to use this for?
What workarounds are you using in the meantime?
The text was updated successfully, but these errors were encountered: