Skip to content

Treat connection close during stop() as handled#1782

Open
lionel- wants to merge 1 commit into
microsoft:mainfrom
lionel-:bugfix/lsp-close-race
Open

Treat connection close during stop() as handled#1782
lionel- wants to merge 1 commit into
microsoft:mainfrom
lionel-:bugfix/lsp-close-race

Conversation

@lionel-
Copy link
Copy Markdown

@lionel- lionel- commented May 28, 2026

We've hit a case where our closed() handler, meant to prevent user-visible toast notifications, was not invoked by languageclient. Our Linux users (likely due to some weird platform-specific race) consistently see a toast notification on restart due to this (posit-dev/positron#7593).

I think this is because the closed() handler is not called when the client is already stopping: https://github.com/lionel-/vscode-languageserver-node/blob/f5e23e29b76c42fad882aa84933d46ba9b412183/client/src/common/client.ts#L1827-L1833. This prevents our handler from setting handled to true.

The fix proposed here is to treat a client that's already stopping as "handled", this way a toast notification isn't displayed.

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.

1 participant