microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.67k stars 29.06k forks source link

Intellisense not working in WSL #231159

Open marko1010 opened 1 week ago

marko1010 commented 1 week ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Open WSL workspace in VS Code
  2. Install node & npm using nvm
  3. Create an index.ts file and import anything

Intellisense will not work for any of the imports. On Windows (outside of WSL) it works fine.

WSL: Image

Windows: Image

It also doesn't work when developing via Remote SSH extension.

It could be something on my end but I spent countless hours trying to fix this to no avail.

It starts TS server fine (screenshot of TypeScript output window), but it uses tsserver from the host and not WSL. Could that be a problem?

Image

I try to force it to use WSL's tsserver by specifying path in workspace json settings: "typescript.tsdk": "/home/marko/.nvm/versions/node/v20.18.0/lib/node_modules/typescript/lib"

But I get the following error despite the fact that the file exists at the given path:

Image

Notice how the error message shows backslashes instead of forward slashes in the file path

cesarvspr commented 1 week ago

Same issue here. No idea how to fix.

I've tried increasing typescript.tsserver.maxTsServerMemory too

mjbvz commented 18 hours ago

Are you using the wsl remote extension to open the workspace or directly opening the wsl folder through windows? It looks it could be the second case, which you almost almost never want. In the true wsl case, the typescript server will automatically run under the wsl linux environment too.

Can you try using the wsl extension to open the workspace instead?