microsoft / microsoft/TypeScript

auto-imports (import suggestions) randomly stopped working

Aperta
#60,376 14 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Needs More Info
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Type: Bug

A little while ago (like over a week now), I was working as I always do, and all of the auto-import suggestions for typescript just stopped working completely. I hadn't updated anything manually (my os, vscode, extensions, node modules, etc). It is possible something auto-updated somewhere behind the scenes, but I haven't been able to track it down.

Essentially no auto-imports work at all in my project anymore. I can't import from relative pathed files, workspace files, or node modules. All typescript imports, once imported work fine and are recognized, but any of the "quick fix" suggestions just don't work at all, both as I type or hovering over a missing reference. The quick fix popup does show, but the only option is my tabnine extension.

What is strange is the imports have worked once since they stopped. I did nothing out of the ordinary and they just randomly started working again. But then as quickly as they appeared, they disappeared.

I've tried all of the following:

  • changing ts versions
  • changing between vscode and project ts references
  • changing my pnpm version
  • turning on and off every one of my extensions
  • changing memory and storage size limits on wsl
  • trying to initialize the project in various ways (docker first, complete rebuilds, etc)
  • nearly every possible setting related to ts and tsserver in the vscode settings
  • nearly every possible intellisense setting I could find that might be related
  • restarting vscode and ts server in various ways
  • changing any settings related to docker, workspaces, or anything else that might affect my ts path lookups

The only other piece of information I have is this error in the ts logs, but I've tried tracking it down, even manually modifying the ts server code and logging things out for a couple hours, with no obvious things that stand out on why it is failing. This error appears when I try to hover over a known missing reference to have it show the imports, but then it just doesn't show them, presumably due to this error (some path parts redacted for privacy reasons).

Info 4708 [11:56:52.468] request:
    {
      "seq": 19,
      "type": "request",
      "command": "quickinfo",
      "arguments": {
        "file": "/<projectPath>/apps/main-app/src/client/components/MyComponent.tsx",,
        "line": 42,
        "offset": 22
      }
    }
Info 4712 [11:56:52.468] request:
    {
      "seq": 20,
      "type": "request",
      "command": "getCodeFixes",
      "arguments": {
        "file": "/<projectPath>/apps/main-app/src/client/components/MyComponent.tsx",
        "startLine": 42,
        "startOffset": 18,
        "endLine": 42,
        "endOffset": 25,
        "errorCodes": [
          2304
        ]
      }
    }
Err 4713  [11:56:52.550] Exception on executing command {
  "seq": 20,
  "type": "request",
  "command": "getCodeFixes",
  "arguments": {
    "file": "/<projectPath>/apps/main-app/src/client/components/MyComponent.tsx",
    "startLine": 42,
    "startOffset": 18,
    "endLine": 42,
    "endOffset": 25,
    "errorCodes": [
      2304
    ],
    "startPosition": 1103,
    "endPosition": 1110
  }
}:

    Debug Failure.

    Error: Debug Failure.
        at Object.getImmediateAliasedSymbol (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:74339:22)
        at getDefaultExportInfoWorker (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:135913:29)
        at getDefaultExportInfoWorker (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:135915:14)
        at getDefaultLikeExportInfo (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:135891:16)
        at /<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:152437:25
        at /<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:135751:119
        at forEachExternalModule (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:135812:7)
        at forEachExternalModuleToImportFrom (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:135751:3)
        at getExportInfos (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:152433:3)
        at /<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:152366:24
        at flatMap (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:2609:17)
        at getFixesInfoForNonUMDImport (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:152360:10)
        at getFixInfos (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:152206:12)
        at Object.getCodeActions (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:151577:18)
        at /<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:148588:46
        at flatMap (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:2609:17)
        at Object.getFixes (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:148588:10)
        at /<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:146859:33
        at flatMap (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:2609:17)
        at Object.getCodeFixesAtPosition (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:146857:12)
        at IpcIOSession.getCodeFixes (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:187265:50)
        at getCodeFixes (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:185371:43)
        at /<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:187569:69
        at IpcIOSession.executeWithRequestId (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:187561:14)
        at IpcIOSession.executeCommand (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:187569:29)
        at IpcIOSession.onMessage (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:187611:51)
        at process.<anonymous> (/<projectPath>/node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/tsserver.js:189220:14)
        at process.emit (node:events:518:28)
        at emit (node:internal/child_process:951:14)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

From what I can conclude, this seems like either a timing issue withing vscode starting things up, or some internal vscode or extension thing somewhere broke behind the scenes. I'm on a wsl docker setup, so there is a lot of linking going on behind the scenes, but given I hadn't changed anything when this started happening, I'm at a complete loss on what to even look for further at this point.

Oh, and unfortunately, I haven't been able to reproduce this on any other machine, so I'm a bit stuck on that front. I'm happy to try modifying any settings suggested, I just have no idea what else to look for at this point.

VS Code version: Code 1.90.0 (89de5a8d4d6205e5b11647eb6a74844ca23d2573, 2024-06-04T19:33:54.889Z)
OS version: Windows_NT x64 10.0.22635
Modes:
Remote OS version: Linux x64 5.15.133.1-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2808)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.89GB (6.29GB free)
Process Argv --crash-reporter-id 10d747f9-1beb-40be-859f-a1379ddf2d04
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.15.133.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 0)
Memory (System) 17.57GB (11.70GB free)
VM 0%
Extensions (32)
Extension Author (truncated) Version
remote-containers ms- 0.369.0
remote-ssh ms- 0.110.1
remote-ssh-edit ms- 0.86.0
remote-wsl ms- 0.88.2
vscode-remote-extensionpack ms- 0.25.0
atom-keybindings ms- 3.3.0
remote-explorer ms- 0.4.3
remote-server ms- 1.5.1
reopenclosedtab uyi 1.1.0
material-theme zhu 3.17.2
vscode-zipfs arc 3.0.0
vscode-tailwindcss bra 0.10.5
vscode-better-align cho 1.4.2
npm-intellisense chr 1.4.5
path-intellisense chr 2.9.0
vscode-css-modules cli 0.5.1
vscode-eslint dba 2.4.4
githistory don 0.6.20
gitlens eam 15.1.0
vscode-search-open-all-results fab 2.0.2
vscode-pull-request-github Git 0.88.1
vscode-duplicate mrm 1.2.1
vscode-docker ms- 1.29.1
atom-keybindings ms- 3.3.0
vsliveshare ms- 1.0.5918
color-highlight nau 2.8.0
gremlins nho 0.26.0
vscode-stylelint sty 1.4.0
tabnine-vscode Tab 3.108.0
reopenclosedtab uyi 1.1.0
vscode-fold-level vik 0.0.14
vscode-svg-previewer vit 0.7.0
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
9b8hh234:30694863
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelc:31048052
dsvsc021:30996838
9c06g630:31013171
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
pythonprt:31056678
dwnewjupyter:31046869
26j00206:31048877

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla richiesta getCodeFixes segnalata e dallo stack Debug Failure in node_modules/typescript@5.4.5/lib/tsserver.js, concentrandoti su getImmediateAliasedSymbol e sul percorso import-fix circostante. Riproduci il problema con la configurazione indicata di VS Code 1.90.0, TypeScript, WSL2 e pnpm, se possibile; il lavoro è completato quando le correzioni del codice di importazione automatica funzionano senza l’eccezione. Non sono indicati né un test del codice sorgente né una riproduzione minima.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript, vscode
Ambito
compilers, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.