Navigation Menu

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

Type highlighting of node_modules is broken in takeover mode. #1641

Closed
Tanimodori opened this issue Jul 27, 2022 · 3 comments
Closed

Type highlighting of node_modules is broken in takeover mode. #1641

Tanimodori opened this issue Jul 27, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@Tanimodori
Copy link

Tanimodori commented Jul 27, 2022

Step to reproduce

  1. git clone https://github.com/cawa-93/vite-electron-builder.git
  2. cd vite-electron-builder
  3. git checkout 1daa1d55c69423ba515045c1f4763c462a0914fd
  4. npm i
  5. Open .\packages\main\tests\unit.spec.ts
  6. Control click vi.fn() to jump to vitest lib (node_modules\vitest\dist\index.d.ts)
  7. Inspect the return type Mock<TArgs, R>
  8. The type highlight is correct in non-takeover mode as shown below. The "show definition" in right click menu (or F12) is working.

JFSXboU7w7

  1. Disable the built-in TS server and reload window to enter takeover mode.
  2. Now the Mock<TArgs, R> shows no type highlight (though it showed "loading..." and then quickly disappears). The "show definition" does not work as shown below.

rKdomhdPIr

Note

  • Other node_modules libs tested out not working too.
  • no tsconfig is not affecting this bug. Include unit.spec.ts into nearest tsconfig.json does not help.
  • Fix the MaybeMocked type in unit.spec.ts does not help. The correct fix for its type is MockedObject fyi.

Environment

  • Volar 0.39.1
  • VSCode 1.69.2
  • Windows 11
@johnsoncodehk johnsoncodehk added the bug Something isn't working label Jul 28, 2022
@johnsoncodehk
Copy link
Member

Can you reproduce this problem in v0.39.5?

@Tanimodori
Copy link
Author

@johnsoncodehk The bug seems identical to me with v0.39.5 and VSCode v1.70.0

@levidavidmurray
Copy link

I'm using WSL, and was having issues with both Volar (takeover mode) and Vetur (Volar disabled) picking up my tsconfig for resolving absolute paths in .vue files. I then noticed—

  1. Install the Remote Development extension pack.

—on the VSCode WSL installation guide.

I figured there were some issues with resolving paths due to VSCode running locally on Windows while the code exists in WSL land—so I was hopeful about this resolving the issue. It however, did not.

I then read about the No tsconfig message that I was getting at the bottom of VSCode, and how this can occur in the event of version mismatches[1]. And this was when I realized that the issue may now be due to the fact that I'm using Nuxt with Nuxt specific typescript support.

I couldn't figure out how to get Volar to work with this. I did try setting typescript.tsdk, but I figured it wouldn't work seeing as how I'm using takeover mode, so Volar itself is handling all the typescript stuff (?).

All my issues were resolved once I switched back to Vetur and reenabled built in TypeScript and Javascript Language Features after installing Remote Development extension pack and reopening my project from WSL (code .)

I'm not sure why it works with Vetur and not Volar. Maybe Volar is making more assumptions about the typescript sdk than Vetur is? Not sure. In any case, I hope this somewhat helps you guys (@johnsoncodehk) figure out these issues with Volar in Windows!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants