Skip to content

Avoid project crash for unknown file types#4268

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-server-crash-unknown-file-type
Draft

Avoid project crash for unknown file types#4268
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-server-crash-unknown-file-type

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Opening a file with an unrecognized extension/language ID could flow ScriptKindUnknown into the project parse cache. The parser rejects unknown script kinds and panicked, taking down the server.

  • Root cause

    • Unknown editor language IDs (for example vue) plus unknown file extensions produced ScriptKindUnknown.
    • Inferred projects allow non-TS extensions, so the file reached parsing instead of being filtered out.
  • Fix

    • Default unknown project file script kinds to TypeScript before acquiring the parse cache, matching TypeScript’s ensureScriptKind fallback behavior.
scriptKind := fh.Kind()
if scriptKind == core.ScriptKindUnknown {
    scriptKind = core.ScriptKindTS
}
  • Regression coverage
    • Added a project test that opens component.vue with language ID vue and verifies the language service can load it without crashing.

Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix fatal server crash on unknown file type Avoid project crash for unknown file types Jun 11, 2026
Copilot AI requested a review from DanielRosenwasser June 11, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown file type(?) triggers fatal server crash

2 participants