sveltejs/language-tools

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

开放

#940 创建于 2021年4月9日

 (5 条评论) (1 个反应) (0 位负责人)TypeScript (247 个派生)auto 404
bughelp wanted

仓库指标

星标
 (1,437 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南