+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

feat(editors): add Restart LSP Server command #3533

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

kaioduarte
Copy link
Contributor

Summary

Closes #3524

Test Plan

Screen.Recording.2022-10-28.at.12.57.42.mov

@kaioduarte kaioduarte requested a review from a team October 28, 2022 12:00
@netlify
Copy link

netlify bot commented Oct 28, 2022

Deploy Preview for docs-rometools ready!

Name Link
🔨 Latest commit e585e2f
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/635bc462b7b83c000885bca6
😎 Deploy Preview https://deploy-preview-3533--docs-rometools.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@kaioduarte kaioduarte changed the title feat: add Restart LSP Server command feat(editors): add Restart LSP Server command Oct 28, 2022
Copy link
Contributor

@leops leops left a comment

Choose a reason for hiding this comment

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

Interestingly while this does have the intended effect of reloading the configuration, this does not actually restart the server process, it's only closing the existing connection to the server and opening a new one. Because we don't currently persist or share workspace instances across sessions it goes through the whole initialization and loading of the configuration again, but it be useful to stop an old version of the Rome server to stop and start a new instance from the latest version.

@MichaReiser
Copy link
Contributor

Interestingly while this does have the intended effect of reloading the configuration, this does not actually restart the server process, it's only closing the existing connection to the server and opening a new one. Because we don't currently persist or share workspace instances across sessions it goes through the whole initialization and loading of the configuration again, but it be useful to stop an old version of the Rome server to stop and start a new instance from the latest version.

How would you recommend implementing such a command. Issue the stop command right before calling into restart?

@leops
Copy link
Contributor

leops commented Oct 28, 2022

Interestingly while this does have the intended effect of reloading the configuration, this does not actually restart the server process, it's only closing the existing connection to the server and opening a new one. Because we don't currently persist or share workspace instances across sessions it goes through the whole initialization and loading of the configuration again, but it be useful to stop an old version of the Rome server to stop and start a new instance from the latest version.

How would you recommend implementing such a command. Issue the stop command right before calling into restart?

Unfortunately sending the stop command will cause the server to exit immediately while the client is still active, so the server will be immediately restarted by the auto-restart behavior of the default error handler in the client library. Ideally we would be able to call client.stop() in a way that doesn't cause it to dispose of the connection to the server so that we could issue the rome/stop request once the state of the extension has been fully cleaned up but that's not something the client library allows by default. We would either have to wrap the connection object we return to the client to prevent it from being closed while the client is being stopped, or re-implement the default error handler in our own code so we could inhibit the auto-restart behavior while we send the stop request.

@MichaReiser
Copy link
Contributor

@leops That sounds significantly more complicated.

Do you agree that the current solution addresses the problem where a user restarts the rome server to clear any client-specific state? And thus, merging it would improve the user experience?

@ematipico
Copy link
Contributor

ematipico commented Oct 28, 2022

I was about to say the same thing that Leo said. This PR doesn't solve the real problem.

merging it would improve the user experience?

For example, if the user updates the rome binary inside the package.json, using this command won't solve the issue. So we are on square one. We could merge it, although we still need to tell the user what are our limitations.

I planned to have a section called Known limitations in the README.md of the extension, you can see it here: https://github.com/rome/tools/pull/3526/files#diff-26e0392cd342e5ae4128c6f6bb669e6326537400604fb0a843332a2293f5cdb9

@leops
Copy link
Contributor

leops commented Oct 28, 2022

Do you agree that the current solution addresses the problem where a user restarts the rome server to clear any client-specific state? And thus, merging it would improve the user experience?

I think it's still worth it to merge this change, and we could also point the user to the rome stop command in the meantime

@ematipico ematipico merged commit 4f5dd00 into rome:main Oct 28, 2022
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.

Add a "Rome: Restart LSP Server" command
4 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载