Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

Avoid project crash for unknown file types - #4268

Closed
Daniel Rosenwasser (DanielRosenwasser) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-server-crash-unknown-file-type
Closed

Daniel Rosenwasser (DanielRosenwasser) with 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.

Copilot AI changed the title [WIP] Fix fatal server crash on unknown file type Avoid project crash for unknown file types Jun 11, 2026
Comment on lines +100 to +102
scriptKind := fh.Kind()
if scriptKind == core.ScriptKindUnknown {
scriptKind = core.ScriptKindTS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like fh should have had the right kind much earlier?

@jakebailey

Copy link
Copy Markdown
Member

Going to preemptively say that #4628 fixes this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown file type(?) triggers fatal server crash

3 participants