vetur
vetur copied to clipboard
Pick up tsconfig from non-top-level folders
fixes #385 fixes #424 fixes #815
Support for different configurations in subfolders (with aliases support). Should work with multi-root projets.
Enables proper application of tsconfig.json and jsconfig.json based on the file tree.
Demo
https://github.com/vuejs/vetur/pull/1734#issuecomment-709608756
Solution
In short, we need multiple language service, not changing configuration. @HerringtonDarkholme https://github.com/vuejs/vetur/pull/349#issuecomment-318223184
A new pair of LanguageService is created for each tsconfig.json instead of just for the root one. Thus, #424 is also fixed.
Features
- [X] Use the nearest
tsconfig.jsonfor each.vuefile - [X] Update corresponding
LanguageServices when atsconfig.jsonis created/changed/deleted
Examples
- https://github.com/yungsilva/monorepo-vetur
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor
does not work with multiple roots.
@yungsilva Thanks for the feedback. Do you have an example of a setup that doesn't work, so that I can try to fix it?
@Minigugus Monorepo made with Lerna + Nuxt.js
https://github.com/yungsilva/monorepo-vetur
Run npx lerna bootstrap in root directory to install dependencies
go to https://github.com/yungsilva/monorepo-vetur/blob/master/website/www/pages/index.vue
And you'll see that the typescript autocomplete doesn't work.
But if you open the www or blog folder in a separate VScode window, it works normally.
@yungsilva Great, thank you, I'll take a look at it soon :wink:
@yungsilva Works for me after merging from master. Could you give try (multi-root, multi-window and single window)?
@Minigugus I don't know if I understood it very well, could you explain it better?
I already have everything on the master, and it doesn't work, even creating another branch from the master, it doesn't work.
Only works .js and .ts files, .vue files only works if you open www or blog in a separate window.
did you look at my repository?
do I need something more than noFallthroughCasesInSwitch": true, in the each project/package tsconfig.json file?
@yungsilva Ok, I'm sorry for not being clear.
I already have everything on the master
Do you mean the master on my fork or in this repository? I worked on the branch subfolders-support, so just checkout the branch subfolders-support on my fork and try again.
You can find debugging instructions here. I don't know how to pack the extension and use it instead of the official vertur extension, so I guess you'll have to wait for a vuejs member to merge this PR.
did you look at my repository?
I tried to open your repository with the changes in this PR and it worked fine. I think you are using the wrong extension version; make sure to checkout the branch subfolders-support.
do I need something more than "noFallthroughCasesInSwitch": true, in the each project/package tsconfig.json file?
"noFallthroughCasesInSwitch": true is just for the test case, to check if the nested tsconfig.json is taken into account. You can get rid of it, just use the configuration you want.
@Minigugus I'd love to try this as well, I'm not sure how to do it. Do you have easy to follow steps or is it possible to upload your fork of Vetur to VSCode, so I can just disable Vetur extension and try your fork?
I think that's easiest for me to test!
thanks a lot!!
Do you have easy to follow steps or is it possible to upload your fork of Vetur to VSCode, so I can just disable Vetur extension and try your fork?
@mesqueeb Sure, just clone my fork, checkout my branch, run yarn && yarn compile, and finally press F5:
git clone https://github.com/Minigugus/vetur.git
cd vetur
git checkout subfolders-support
yarn
yarn compile
Once done, press F5 in VSCode to run a special VSCode instance that only contains the Vetur extension in debug mode. You can now open a Vue project with tsconfig.json issues, such as a monorepo for instance, like https://github.com/yungsilva/monorepo-vetur.
Is there a reason this hasn't been merged?
Is there a reason this hasn't been merged?
Current , vetur supported multi root project from v0.31.0