Skip to content

fix: fix crash when open non-ts files#295

Merged
hardfist merged 1 commit intomainfrom
fix-crash
Aug 22, 2025
Merged

fix: fix crash when open non-ts files#295
hardfist merged 1 commit intomainfrom
fix-crash

Conversation

@hardfist
Copy link
Copy Markdown
Contributor

@hardfist hardfist commented Aug 22, 2025

typescirpt-go has a check for returned diagnostics to ensure at least return non-nil for diagnosticReport https://github.com/microsoft/typescript-go/blob/bca9518930e5bc91885a9c959283bab4b4de015c/internal/lsp/lsproto/lsp_generated.go#L24559
return empty FullDocumentDiagnosticReport to avoid crash

Copilot AI review requested due to automatic review settings August 22, 2025 04:12
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 22, 2025

Deploy Preview for rslint canceled.

Name Link
🔨 Latest commit 7bab0f8
🔍 Latest deploy log https://app.netlify.com/projects/rslint/deploys/68a7ee4406c6100008d2897b

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a crash that occurs when the LSP service processes non-TypeScript files by returning a proper diagnostic response structure instead of an empty one.

Key changes:

  • Return a properly structured RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport for non-TypeScript files
  • Move diagnostic variable declaration outside the TypeScript file check to be reusable

@hardfist hardfist merged commit 7e3e534 into main Aug 22, 2025
12 checks passed
@hardfist hardfist deleted the fix-crash branch August 22, 2025 04:23
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.

3 participants