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

Volar intellisense takeover mode does not resolve external workspaces/packages (monorepo) #19

Closed
blake-newman opened this issue Mar 16, 2023 · 2 comments · Fixed by #24
Labels
enhancement New feature or request

Comments

@blake-newman
Copy link
Contributor

Volar is not handling resolving external workspaces/packages within monorepo.

Reproduction: https://github.com/blake-newman/vue-tsc-import-resolution

takeover mode: off

When takeover mode is off it is able to auto import the modules/dependencies from external workspaces/packages

  • Enable the built-in TypeScript Extension
    • Run Extensions: Show Built-in Extensions from VSCode's command palette
    • Find TypeScript and JavaScript Language Features, right click and select Enable (Workspace)
  • Reload the VSCode window by running Developer: Reload Window from the command palette.
  • Within ./packages/main/src/index.ts try to use isFalse function from b package.
    • The exported function is found in intelisense and choosing that will auto import the dependency.

Screenshot 2023-03-16 at 09 01 37

takeover mode: on

When takeover mode is on it is unable to auto import modules/dependencies from external workspaces/packages

  • Enable the built-in TypeScript Extension
    • Run Extensions: Show Built-in Extensions from VSCode's command palette
    • Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  • Reload the VSCode window by running Developer: Reload Window from the command palette.
  • Within ./packages/main/src/index.ts try to use isFalse function from b package.
    • The exported function is not found in intelisense

Screenshot 2023-03-16 at 08 58 19

@blake-newman
Copy link
Contributor Author

@johnsoncodehk I'm unfamiliar with where the module resolution for intellisense takes place.

This doesn't appear to be due to project references as disabling this, see no-project-references branch in reproduction, has the same behavior.

@blake-newman
Copy link
Contributor Author

I can reproduce the same behaviour with TypeScript language server with includePackageJsonAutoImports: "off", by default it set to auto.

blake-newman added a commit to blake-newman/volar.js that referenced this issue Mar 20, 2023
Enable auto import by creating a real TS project and project service
proxing the project methods to the languageServerHost.

As we use a real project behind the scenes the language host no longer
needs the auto import cache package to decorate as the project itself
provides the module specifier and import caching behaviour.

fixes: volarjs#19
fixes: vuejs/language-tools/issues#963
fixes: vuejs/language-tools/issues#1738
blake-newman added a commit to blake-newman/volar.js that referenced this issue Mar 20, 2023
Enable auto import by creating a real TS project and project service
proxing the project methods to the languageServerHost.

As we use a real project behind the scenes the language host no longer
needs the auto import cache package to decorate as the project itself
provides the module specifier and import caching behaviour.

fixes: volarjs#19
fixes: vuejs/language-tools#963
fixes: vuejs/language-tools#1738
blake-newman added a commit to blake-newman/volar.js that referenced this issue Mar 22, 2023
Enable auto import by creating a real TS project and project service
proxing the project methods to the languageServerHost.

As we use a real project behind the scenes the language host no longer
needs the auto import cache package to decorate as the project itself
provides the module specifier and import caching behaviour.

fixes: volarjs#19
fixes: vuejs/language-tools#963
fixes: vuejs/language-tools#1738
blake-newman added a commit to blake-newman/volar.js that referenced this issue Mar 22, 2023
Enable auto import by creating a real TS project and project service
proxing the project methods to the languageServerHost.

As we use a real project behind the scenes the language host no longer
needs the auto import cache package to decorate as the project itself
provides the module specifier and import caching behaviour.

fixes: volarjs#19
fixes: vuejs/language-tools#963
fixes: vuejs/language-tools#1738
@johnsoncodehk johnsoncodehk added the enhancement New feature or request label Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants