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

貢獻者指南