zed-gdscript icon indicating copy to clipboard operation
zed-gdscript copied to clipboard

Automatically restart the language server or try to reconnect when needed

Open NathanLovato opened this issue 1 year ago • 2 comments

Currently, when the language server will not connect, because Godot is not launched, or because Godot was closed, there is no information to the user, and the extension will not try to reconnect automatically.

We should see if there are hooks in zed that would allow us to try to reconnect automatically.

A separate improvement would be to inform the user when the server disconnected, although I don't know if Zed currently has a provision for this.

NathanLovato avatar Aug 15 '24 07:08 NathanLovato

I attempted implementing this by writing a go binary that replaces netcat and has support for reconnecting.

~~It all seemed to work fine, detecting that Godot had restarted for example and reconnecting except on reconnect it seems that Zed was dropping the connection which caused it to keep restarting all the time.~~

It seems to work find in terms of reconnecting now, but it looks like the context for the LSP needs to be sent again after reconnecting.

Maybe this won't be possible until Zed extensions support reconnecting directly.

moomerman avatar Aug 24 '24 09:08 moomerman

Thanks for looking into this! I looked at the API provided by Zed only briefly. To me, this is something that needs to be handled from the code editor: ideally, we would offer to spawn a Godot process directly from Zed if needed, and detect and warn the user when the server disconnects (e.g. because the Godot editor was restarted or closed), all from Zed.

I don't know yet if this is possible.

NathanLovato avatar Aug 24 '24 10:08 NathanLovato