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

Pick up tsconfig from non-top-level folders #1734

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Minigugus
Copy link

@Minigugus Minigugus commented Feb 25, 2020

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

#1734 (comment)

Solution

In short, we need multiple language service, not changing configuration.
@HerringtonDarkholme #349 (comment)

A new pair of LanguageService is created for each tsconfig.json instead of just for the root one. Thus, #424 is also fixed.

Features

  • Use the nearest tsconfig.json for each .vue file
  • Update corresponding LanguageServices when a tsconfig.json is created/changed/deleted

Examples


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@Minigugus Minigugus changed the title Subfolders support Subfolders and tsconfig support Apr 16, 2020
@ghost
Copy link

ghost commented Aug 7, 2020

does not work with multiple roots.

@Minigugus
Copy link
Author

@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?

@ghost
Copy link

ghost commented Aug 7, 2020

@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.

@Minigugus
Copy link
Author

@yungsilva Great, thank you, I'll take a look at it soon 😉

@Minigugus
Copy link
Author

@yungsilva Works for me after merging from master. Could you give try (multi-root, multi-window and single window)?

@ghost
Copy link

ghost commented Aug 7, 2020

@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?

@Minigugus
Copy link
Author

@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 Minigugus mentioned this pull request Aug 7, 2020
@Minigugus Minigugus changed the title Subfolders and tsconfig support Pick up tsconfig from non-top-level folders Aug 10, 2020
@Minigugus Minigugus mentioned this pull request Aug 10, 2020
17 tasks
@mesqueeb
Copy link

@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!!

@Minigugus Minigugus mentioned this pull request Oct 15, 2020
@Minigugus
Copy link
Author

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.

@MaxLeiter
Copy link

Is there a reason this hasn't been merged?

@kytosai
Copy link

kytosai commented May 2, 2022

Is there a reason this hasn't been merged?

Current , vetur supported multi root project from v0.31.0

CHANGELOG

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