Repository: TypeScript
Issue: TypeScript language server fails to recognize new files and needs restart
Labels: Needs More Info

Type: <b>Bug</b>

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:
```json
{
  "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:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M1 Max (10 x 2400)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>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%|
</details><details><summary>Extensions (37)</summary>

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


</details><details>
<summary>A/B Experiments</summary>

```
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

```

</details>

<!-- generated by issue reporter -->