Skip to content

Conversation

ahejlsberg
Copy link
Member

Fixes a crash in the language service:

const f = () => 42  // Delete () and LSP panics

@Copilot Copilot AI review requested due to automatic review settings October 3, 2025 15:53
Copy link
Contributor

@Copilot 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 in the language service that occurs when parsing malformed arrow functions where the parameter list parentheses are deleted. The fix ensures that the Parameters property of arrow functions is never nil by providing an empty node list as a fallback.

  • Adds initialization of parameters variable with an empty node list when parameter parsing fails in ambiguous parsing contexts

@ahejlsberg ahejlsberg requested a review from jakebailey October 3, 2025 15:53
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Hopefully all of the other signature like things all have this set too (it was required in the old code)

@ahejlsberg
Copy link
Member Author

Hopefully all of the other signature like things all have this set too (it was required in the old code)

I check all the code paths for parsing signatures, and this should be the only one that could cause a nil.

@ahejlsberg ahejlsberg added this pull request to the merge queue Oct 3, 2025
Merged via the queue into main with commit 162a3f4 Oct 3, 2025
22 checks passed
@ahejlsberg ahejlsberg deleted the fix-lsp-panic-1 branch October 3, 2025 17:25
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.

2 participants