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

Vue js Volar plugin fails to find typescript.js #12443

Closed
CannyDuck opened this issue Apr 21, 2023 · 6 comments
Closed

Vue js Volar plugin fails to find typescript.js #12443

CannyDuck opened this issue Apr 21, 2023 · 6 comments
Labels
help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility

Comments

@CannyDuck
Copy link

The volar plugin fails to finde the required typescript module to work.

Message: Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in D:\Tools\theia-blueprint\node_modules\@theia\plugin-ext\lib\plugin\node\extensions\node_modules\typescript\lib

Maybe the plugin search in the wrong path. I find the typescript.js in D:\Tools\theia\node_modules\typescriptt\lib

Any idea how to fix that?

Bug Description:

  1. install the volar plugin
  2. see error in output window

Additional Information

  • Operating System: Windows 10
  • Theia Version: 1.36
@msujew
Copy link
Member

msujew commented Apr 21, 2023

For anyone looking to investigate this, the path in question seems to be very suspiciously looking like the path we return for vscode.env.appRoot. However, after a quick search, the volar extension doesn't seem to be using it. Neither can I find the error message. It might be that the extension is using some dependency that produces this error.

@msujew msujew added vscode issues related to VSCode compatibility help wanted issues meant to be picked up, require help labels Apr 21, 2023
@mind-ar
Copy link

mind-ar commented Dec 30, 2023

Hi, it seems like volar is using vscode.env.appRoot here: https://github.com/volarjs/volar.js/blob/cd3695a14a9156e74735fff66451062dc862ef1c/packages/vscode/lib/features/tsVersion.ts#L141C1-L166C3

the error is thrown here: https://github.com/volarjs/volar.js/blob/cd3695a14a9156e74735fff66451062dc862ef1c/packages/language-server/node.ts#L86-L117

here's a workaround (for linux):

mkdir ~/node_modules/@theia/plugin-ext/lib/plugin/node/extensions
ln -s  ~/node_modules ~/node_modules/@theia/plugin-ext/lib/plugin/node/extensions/

I don't know if this issue must be solved here, or if it's better to open an issue in volar repo

BTW, sorry for my spelling, not i don't speak english too much

@msujew
Copy link
Member

msujew commented Dec 30, 2023

@mind-ar Thanks for looking into it! Yeah, seems like the volar extension is using some very specific behavior of vscode that cannot be (easily) replicated by every Theia app. The volar extension seems to rely on the fact that there's always an extensions folder containing the TypeScript extension in the application root folder. This is always correct for vscode, but almost never in Theia. It might make sense to create an issue there, maybe someone is interested in fixing the behavior to also work in Theia.

Note that the value we return for vscode.env.appRoot is still not correct. I'm pretty sure it's supposed to return ApplicationPackage#projectPath instead.

@mind-ar
Copy link

mind-ar commented Dec 30, 2023

Hi @msujew , thanks for the response.
Another workaround is to install the "JavaScript and TypeScript Nightly" (ms-vscode.vscode-typescript-next)

I agree that vscode.env.appRoot should point to the theia root folder, even if this doesn't solve the current problem.

I'll open an issue in volar to see if it can be solved at their side

BTW: i love theia!!

Thanks!

@msujew
Copy link
Member

msujew commented Jun 4, 2024

@mind-ar I've created a PR over at the Volar repo, see volarjs/volar.js#195. Note that this doesn't really fix the issue (there is no real fix, since Theia just works differently from VS Code), but instead provides a helpful message when no TypeScript distribution can be found.

@msujew
Copy link
Member

msujew commented Jun 5, 2024

The PR volarjs/volar.js#195 has been merged and the associated issue over at the volar repo closed. I'll close this one as well.

@msujew msujew closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility
Projects
None yet
Development

No branches or pull requests

3 participants