-
Notifications
You must be signed in to change notification settings - Fork 374
fix: suppress websocket error after connection lost #3270
Conversation
a-b-r-o-w-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd like to see something that clearly shows that these errors are, in fact, connection errors.
In the description you mention we already have retry logic, so it's a little confusing to me that this code would throw. I'm not super familiar with the language servers / monaco though so I take my thoughts lightly. At minimum I would expect something like:
try {
await languageClient.onReady();
languageClient.sendRequest('initializeDocuments', { uri, luOption });
} catch (err) {
if (err instanceof ConnectionError) {
await languageClient.reconnect();
}
}This code could already be happening somewhere, but the error manifestation seems odd to me if so.
I did not thought clear. The retry logic only resume connection, didn't re-send request.
If phase-1 failed, retry connecting would not exec I should let retry cover initialize document, please HOLD. |
|
@a-b-r-o-w-n updated, the screen gif shows two connection lost scenarios. |
| }); | ||
| } | ||
|
|
||
| SendRequestWithRetry(languageClient, 'initializeDocuments', { luOption, uri }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be awaited to ensure the document has been initialized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhixzhan I am going to go ahead and take this but please respond here when you get back online and create a follow-up PR if this needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked code below SendRequestWithRetry(languageClient, 'initializeDocuments', {, nothing relied on it.
One effect is before initializeDocuments success, in LSP editor interface all information needs come from LSP server ( diagnostics/suggustions...) would be empty, looks like writing in a plain text-editor.
* report bug template add `Electron` * mute LSP WebSocket connection lost pop up error * refine re-connection * use SendRequestWithRetry Co-authored-by: Chris Whitten <[email protected]> Co-authored-by: Andy Brown <[email protected]>
Description
LG/LU editor use WebSocket connect to LSP server, this may failed when page is idle or network is poor, and at this moment inline editor's inside suggestion/check would not work.
we have auto re-connection, so mute the failed alert sounds reasonable.
Task Item
close #3167
Screenshots
Connection lost & resume after editor open.
Connection lost & resume before editor open.