Skip to content

"Go To Definition" in VS Code does not work for Typescript projects using Yarn 2 PnP #940

Open
@abrenneke

Description

@abrenneke

Describe the bug
When you're using Yarn 2 PnP with a typescript project, an error occurs when using "Go To Definition" on an imported symbol.

To Reproduce

  • Take the template app, npx degit sveltejs/template svelte-typescript-app
  • Install typescript support node scripts/setupTypeScript.js
  • Install Yarn 2 yarn set version berry
  • Make sure ZipFS extension is installed in VS Code
  • Follow svelte-language-tools yarn pnp setup steps
  • (Maybe some steps I'm forgetting to get things working normally)
  • Import anything in the App.svelte file
  • Control-click your import

Error:

Unable to open 'index.d.ts': Unable to read file '.../.yarn/cache/svelte-npm-3.37.0-87abf2d623-fc7a1e9b64.zip/node_modules/svelte/types/runtime/index.d.ts' (EntryNotADirectory (FileSystemError): Error: ENOTDIR: not a directory, stat '.../.yarn/cache/svelte-npm-3.37.0-87abf2d623-fc7a1e9b64.zip/node_modules/svelte/types/runtime/index.d.ts').

Note that this works when control-clicking a file in a .ts file in the same project. That makes me think that there's something going on in the transition between VS Code and tsserver, which would be svelte-language-server I think. I've looked around but haven't seen any discussion on this yet, but lots of discussions which enabled this support in the Typescript language server - something about passing file paths around that aren't literal paths on the system.

Expected behavior
Same behavior as in a .ts file.

System (please complete the following information):

  • OS: Mac OS
  • Plugin/Package: svelete-language-server

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions