microsoft / microsoft/TypeScript

TypeScript language server fails to recognize new files and needs restart

オープン
#60,040 コメント 5 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs More Info
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

報告された Next.js プロジェクト構成で、新しい TS ファイルと TSX ファイルを作成またはコピーして問題を再現し、その後、TypeScript 言語サーバーを再起動する前後で補完と React の認識をテストします。新しく作成されたファイルの言語サーバーでの処理を追跡します。完了の条件は、手動で再起動したり説明のつかない遅延が発生したりすることなく、プロジェクトの import、React、JSX が認識されることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
nextjs, typescript, vscode
領域
developer-experience, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。