zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.99k stars 2.7k forks source link

vue-language-server does not working when using workspaces #12019

Open joshuaia opened 4 months ago

joshuaia commented 4 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

After moving vue support from Zed to extension, in workspace dependent repositories vue-language-server stopped working.

To reproduce:

  1. Clone https://github.com/hoppscotch/hoppscotch
  2. Install all packages from root of the project using pnpm i (you may see some errors after the installation ends, you can skip them, they does not effect on this reproduction)
  3. Navigate to any vue file (for example inside pages in hoppscotch-sh-admin package)
  4. Zed will notify you in status bar about downloading vue-language-server
  5. After downloading will finish try to hover on some code inside ts script block, it won't work. BTW I can't see any logs and related errors, it feels like vue server is not installed at all.

It happens only for vue-language-server, ts server works well, you can try to open any ts file in this repo and you will see it in action.

Environment

Zed: v0.135.2 (Zed) OS: macOS 14.5.0 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

mtorromeo commented 3 months ago

I have a similar issue with this error in console:

[2024-06-10T10:25:16+02:00 ERROR project] failed to start language server "vue-language-server": Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in node_modules/typescript/lib
[2024-06-10T10:25:16+02:00 ERROR project] server stderr: Some("")
[2024-06-10T10:25:16+02:00 ERROR project] Hit 4 reinstallation attempts for "vue-language-server"
[2024-06-10T10:25:16+02:00 ERROR util] crates/lsp/src/lsp.rs:782: oneshot canceled

In my case I am not using a workspace but Zed is opened on a monorepo with 2 distinct vue apps in subfolders (eg. app1/package.json, app2/package.json) but the plugin is only looking for node_modules/typescript/lib in the root folder.

If I open only one of the 2 apps directly in Zed everything works correctly

bitfactory-oussama-fadlaoui commented 2 months ago

+1 whenever opening a project with the frontend inside of the project folder that's opened (e.g. in a headless application with /frontend and /backend)

maxdeviant commented 1 month ago

@joshuaia I was able to reproduce the issue in v0.0.3 of the Vue extension.

Once I upgraded to v0.1.0 of the extension (which was released earlier today), things seem to be working as expected.

Could you give it a try with v0.1.0 and see if that fixes your issue?


Also, thank you so much for including a clear repro and an example project. It made it very easy for me to test!

joshuaia commented 1 month ago

@maxdeviant thanks a lot! It works perfectly. I really appreciate your help!