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

Support sub folders and multiple tsconfig files in one window #385

Closed
2 tasks done
ubershmekel opened this issue Aug 14, 2017 · 4 comments · May be fixed by #1734
Closed
2 tasks done

Support sub folders and multiple tsconfig files in one window #385

ubershmekel opened this issue Aug 14, 2017 · 4 comments · May be fixed by #1734

Comments

@ubershmekel
Copy link

ubershmekel commented Aug 14, 2017

Info

  • Platform: macOS
  • Vetur version: 0.9.3
  • VSCode version: 1.15.0

Problem

tsconfig.json is ignored if it isn't in the root of the vs code window.

For example:

file: 'file:///Users/yuval/rylo/nuxtsc/a/pages/index.vue'
severity: 'Error'
message: 'Cannot find module '~plugins/nuxt-class-component'.'
at: '17,23'
source: ''

file: 'file:///Users/yuval/rylo/nuxtsc/a/pages/index.vue'
severity: 'Error'
message: 'Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.'
at: '21,1'
source: ''

Errors in vs code

Reproducible Case

git clone https://github.com/johnlindquist/nuxt-typescript a
git clone https://github.com/johnlindquist/nuxt-typescript b
code .
# now open pages/index.js and see the errors

Based on this code it seems to me there is no support to do this currently

const configFilename = ts.findConfigFile(workspacePath, ts.sys.fileExists, 'tsconfig.json') ||

https://github.com/Microsoft/TypeScript/blob/37b20ee670e9a89307b0e69960a2cbce104f93e5/src/compiler/program.ts#L8

@octref
Copy link
Member

octref commented Dec 5, 2017

After thinking through it, it's impossible to do this.
For a workspace, I can't look at each tsconfig.json and create a language service based on it. In TypeScript, you do tsconfig.json per project, and tsconfig.json has to be located in the root of the proejct.
Instead, the way you should work on two Vue codebases together is to use the new multi-root https://code.visualstudio.com/updates/v1_18#_support-for-multi-root-workspaces feature.
I'll implement #424, where I spawn one Vue language service for a workspaceFolder if it contains a package.json with vue in it.

@octref octref closed this as completed Dec 5, 2017
@octref octref added the wontfix label Dec 5, 2017
@WolfspiritM
Copy link

I stumbled over this issue as well as I was wondering why I kept getting experimentalDecorators warning over and over even so I added that to my tsconfig.json. Creating a "*.ts" file beside the vue file with the same code handled it correctly.

I also found microsoft/vscode#3772 which explains the "same" issue on the "official TS" side and a comment from egamma from Microsoft stated that it is explicitly supported by vscode and should work. If that is vscode behaviour then I think vetur should also support it in the same way.

However I can understand if there are technical reasons why this can't be implemented.

@Stupidism
Copy link

@octref I'm using yarn workspaces with lerna, and one of my repo is next.

Before add the folder:
image

Your solution works perfect for me!

@robodude666
Copy link

robodude666 commented May 16, 2020

@octref Are your views from 2017 still the same? "won't fix" ? You mentioned here microsoft/vscode#68343 (comment) that you need to revive this issue.

@Minigugus provided a PR: #1734 that seems to address this issue.

Mono repos are gaining popularity with lerna/yarn workspaces. VSCode's TS support seems to support non-root tsconfig files no problem in my other packages/* projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants