microsoft / microsoft/TypeScript

TypeScript language server fails to recognize new files and needs restart

Aperta
#60,040 5 commenti 5 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Type: Bug

Since the last update(s) or so, the TypeScript language server fails to recognize or do any code completion on newly created (or copy-pasted) files, no matter if they are TS or TSX.

With TS files it fails to do code completion for any other code from my project (cannot find anything from my project to import when I do CTRL+SPACE).

For TSX files, it fails to recognize React and all I get is syntax errors for JSX code.

I have to manually restart the TS language server in order to fix this. That or wait ~5s.

Context:

  • I am on the latest TS version 5.5.4
  • I am working on a typical NextJS (14.2.5) project with shadcn-ui components.
    tsconfig is the nextj's default:
{
  "compilerOptions": {
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "target": "ES2020",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules", ".next"]
}

VS Code version: Code 1.92.1 (Universal) (eaa41d57266683296de7d118f574d0c2652e1fc4, 2024-08-07T20:16:39.455Z)
OS version: Darwin arm64 23.5.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 x 2400)
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
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 2, 2
Memory (System) 32.00GB (1.05GB free)
Process Argv --crash-reporter-id 593ea142-22bd-42ca-a19a-94f980be787b
Screen Reader no
VM 0%
Extensions (37)
Extension Author (truncated) Version
rust-bundle 1Yi 1.0.0
html-class-suggestions And 1.2.1
biome bio 2.3.0
vscode-tailwindcss bra 0.12.6
npm-intellisense chr 1.4.5
path-intellisense chr 2.9.0
vscode-css-modules cli 0.5.1
vscode-notes dio 1.2.1
rust-syntax dus 0.6.1
prettier-vscode esb 10.4.0
html-slim-scss-css-class-completion gen 1.7.8
codespaces Git 1.17.2
copilot Git 1.221.0
copilot-chat Git 0.18.1
vscode-github-actions git 0.26.3
vscode-scss mrm 0.10.0
black-formatter ms- 2024.2.0
debugpy ms- 2024.10.0
python ms- 2024.12.2
vscode-pylance ms- 2024.8.1
jupyter ms- 2024.7.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.19
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
live-server ms- 0.4.14
vscode-speech ms- 0.10.0
material-icon-theme PKi 5.9.0
vscode-css-peek pra 4.4.1
code-snapshot rob 0.2.1
rust-analyzer rus 0.3.2062
tauri-vscode tau 0.2.6
luna-paint Tyr 0.16.0
vscode-mdx uni 1.8.9
vscode-wakatime Wak 24.6.0
pretty-ts-errors Yoa 0.6.0
vscode-className-completion zwk 0.0.18
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
da93g388:31013173
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
2f103344:31071589
impr_priority:31102340
refactort:31108082
pythonrstrctxt:31112756
wkspc-onlycs-t:31111718
wkspc-ranged-t:31111713

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

Riproduci il problema nella configurazione del progetto Next.js indicata creando o copiando nuovi file TS e TSX, quindi verifica il completamento e il riconoscimento di React prima e dopo il riavvio del server del linguaggio TypeScript. Traccia la gestione dei file appena creati da parte del server del linguaggio; il lavoro è completato quando gli import del progetto, React e JSX vengono riconosciuti senza un riavvio manuale o un ritardo inspiegabile.

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

Valutazione

Stack tecnologico
nextjs, typescript, vscode
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.