Skip to content

Fix LSP connection error notification on restart#13846

Merged
lionel- merged 2 commits into
mainfrom
bugfix/lsp-connection
May 28, 2026
Merged

Fix LSP connection error notification on restart#13846
lionel- merged 2 commits into
mainfrom
bugfix/lsp-connection

Conversation

@lionel-
Copy link
Copy Markdown
Contributor

@lionel- lionel- commented May 28, 2026

Closes #7593

@midleman @rodrigosf672 Could you please see if this branch fixes your skipped tests?

I think the notification is due to our closed() handler (

public closed(): CloseHandlerResult {
LOGGER.warn(`ARK (R ${this._version}) language client was closed unexpectedly (port ${this._port}).`);
return { action: CloseAction.DoNotRestart, handled: true };
}
) not being 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.

To work around this, we hook into the client's error handler to manually ignore these errors.

Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

Validation Steps

Verified manually on my Linux laptop.

@:ark @:web

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:ark @:web

readme  valid tags

@lionel- lionel- force-pushed the bugfix/lsp-connection branch from 62e476d to cb70032 Compare May 28, 2026 13:38
@midleman
Copy link
Copy Markdown
Contributor

@lionel- i just unskipped the test and added the web test tag in PR description to either confirm or deny the test is happy. 🤞

@rodrigosf672
Copy link
Copy Markdown
Member

rodrigosf672 commented May 28, 2026

@lionel-, I'm pulling this change into my branch and will see if my (unskipped) test is happy as well. Thank you!

@lionel-
Copy link
Copy Markdown
Contributor Author

lionel- commented May 28, 2026

Upstream fix: microsoft/vscode-languageserver-node#1782

@lionel- lionel- requested a review from DavisVaughan May 28, 2026 14:24
@lionel- lionel- merged commit e2f55b0 into main May 28, 2026
48 checks passed
@lionel- lionel- deleted the bugfix/lsp-connection branch May 28, 2026 18:59
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
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.

"Connection to server got closed" when restarting the R session

4 participants