Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way force TS Server to use a specific set of tsconfig/jsconfigs #33094

Open
mjbvz opened this issue Aug 26, 2019 · 10 comments
Open

Add way force TS Server to use a specific set of tsconfig/jsconfigs #33094

mjbvz opened this issue Aug 26, 2019 · 10 comments
Labels
Rescheduled This issue was previously scheduled to an earlier milestone Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Aug 26, 2019

From microsoft/vscode#12463

Search Terms

  • tsconfig / jsconfig
  • tsserver

Problem

Some common project templates (such as angular) generate config file with names such as tsconfig.dev.json. The TS Server used by VS Code will not load this project because the file is not named tsconfig.json. We only load project files exactly named tsconfig.json

Feature Request

Allow users to configure a specific set one or more project config files that the TS Server should load, such as /Users/matb/project/test/tsconfig.dev.json. This could either be configured using a server command line flag or using the configure request in TS

How do we handle additional projects?

If specific project files have been configured, one proposal is that we only load those projects (and never fall back to loading additional projects). Using this approach, when a user opens a new file:

  • If that file is part of one of the configured projects, then open it inside the project
  • Otherwise load the file in the inferred/global project

As an alternative to this to better support multi-root workspaces in VS Code, we could instead only fall back to loading an additional project if that project is not under the roots of any of the configured projects. For example, if I configured /Users/matb/project/test/tsconfig.dev.json as the project to load, we should never load additional projects under: /Users/matb/project/test/** but could load ones from under /Users/matb/project/other/**

@mjbvz mjbvz changed the title Add way force TS Server to work a specific set of projects Add way force TS Server to work a specific set of tsconfig/jsconfigs Aug 26, 2019
@mjbvz mjbvz changed the title Add way force TS Server to work a specific set of tsconfig/jsconfigs Add way force TS Server to use a specific set of tsconfig/jsconfigs Aug 26, 2019
@sheetalkamat
Copy link
Member

Vs uses external projects and it can contain tsconfig files .. may be we could use that approach instead..

@mjbvz mjbvz added the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label Aug 29, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.8.0 milestone Sep 19, 2019
@RyanCavanaugh RyanCavanaugh added Committed The team has roadmapped this issue Suggestion An idea for TypeScript labels Sep 19, 2019
@Droseyge92
Copy link

Users/matb/project/test/tsconfig.dev.json. This could either be configured using a server command line flag or using the configure

@DanielRosenwasser
Copy link
Member

Removing the "committed" label, not because I don't think this is going to happen, but because "Committed" implies it's on the next roadmap. Having spoken offline, we will likely revisit this in the future in the next 6-months.

@DanielRosenwasser DanielRosenwasser added the VS Code Tracked There is a VS Code equivalent to this issue label Jan 24, 2020
@RyanCavanaugh RyanCavanaugh removed the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label Jan 24, 2020
@RyanCavanaugh
Copy link
Member

Tentatively slotting for 3.9

@gluxon
Copy link
Contributor

gluxon commented Aug 18, 2020

@RyanCavanaugh Would you take a pull request for this? If so, has it been decided whether a command line flag or configure request would be preferred?

@lobsterkatie
Copy link

Any update on this? Anything any of us can do to help move this along?

lobsterkatie added a commit to getsentry/sentry-javascript that referenced this issue Jun 2, 2022
It is well-documented (see 1-6 below) that VSCode doesn't support setups like ours, where multiple tsconfig files coexist in a single directory. Strangely, though, it is only recently that this has become a problem, with VSCode at random intervals forgetting that it's ever heard of `expect` or `describe` (because it's not seeing `tsconfig.test.json`, but taking a while to realize it).

There is an open issue[7] tracking the addition of support for this, but it's been open for a long time, with little movement. In the meantime, this solves the problem by adding placeholder `test/tsconfig.json` files to each package, each pointing to its corresponding `tsconfig.test.ts` file. I went with this approach over simply moving and renaming the existing test tsconfigs because this allows us to stay consistent in having all flavors of tsconfig for a package live at the package root level, and provides an easy way to reverse this workaround, should VSCode ever fix the underlying problem.

[1] angular/angular-cli#5175
[2] microsoft/TypeScript#49210
[3] microsoft/vscode#107750
[4] microsoft/vscode#12463
[5] sillsdev/bible-karaoke#175
[6] microsoft/TypeScript#8435
[7] microsoft/TypeScript#33094
lobsterkatie added a commit to getsentry/sentry-javascript that referenced this issue Jun 3, 2022
It is well-documented (see 1-6 below) that VSCode doesn't support setups like ours, where multiple tsconfig files coexist in a single directory. Strangely, though, it is only recently that this has become a problem, with VSCode at random intervals forgetting that it's ever heard of `expect` or `describe` (because it's not seeing `tsconfig.test.json`, but taking a while to realize it).

There is an open issue[7] tracking the addition of support for this, but it's been open for a long time, with little movement. In the meantime, this solves the problem by adding placeholder `test/tsconfig.json` files to each package, each pointing to its corresponding `tsconfig.test.ts` file. I went with this approach over simply moving and renaming the existing test tsconfigs because this allows us to stay consistent in having all flavors of tsconfig for a package live at the package root level, and provides an easy way to reverse this workaround, should VSCode ever fix the underlying problem.

[1] angular/angular-cli#5175
[2] microsoft/TypeScript#49210
[3] microsoft/vscode#107750
[4] microsoft/vscode#12463
[5] sillsdev/bible-karaoke#175
[6] microsoft/TypeScript#8435
[7] microsoft/TypeScript#33094
@HarTstaRx
Copy link

@RyanCavanaugh any update on this? Is there anything we can do to make this done?

@albertodiazdorado
Copy link

Bump

@mccolljr
Copy link

mccolljr commented Mar 7, 2024

This issue is almost 5 years old, with an update from 2020 saying "we will try to plan this in the next 6 months"... Is there any plan to move forward on this?

@randallt21
Copy link

just a friendly little bump
this feature would be very nice for conflicting types in different types of testing files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rescheduled This issue was previously scheduled to an earlier milestone Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests