Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added xml.restart.language.server command for language server restart #551

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

AlexXuChen
Copy link
Contributor

@AlexXuChen AlexXuChen commented Jul 16, 2021

Added xml.restart.language.server command to trigger language server restart.
Peek 2022-07-20 13-16

Closes #539

Signed-off-by: Alexander Chen [email protected]

@AlexXuChen
Copy link
Contributor Author

If someone else can quickly confirm for me, when running the command, the client command registration seems to re-trigger, which tells me that the language client is restarting. Can someone confirm this, or give me another check to see if the language client has restarted?

@GitMensch
Copy link
Contributor

Thanks for the PR!

The best option to check this is to inspect the processes (top -u $(whoami) or Taskmanager/Sysinternals ProcessExplorer on win32). Before and after issuing the command.

@AlexXuChen AlexXuChen changed the title added xml.restart.language.server command added xml.restart.language.server command (draft) Jul 20, 2021
@GitMensch
Copy link
Contributor

Is there a reason that this is still on draft? The original implementation seemed fine and the linked issue is still open...

@AlexXuChen
Copy link
Contributor Author

AlexXuChen commented Jul 20, 2022

Using languageClient.restart() does the trick, however we need to use vscode-languageclient version ^8.0.0, which like @rgrunber mentioned isn't supported on Theia:
Peek 2022-07-20 12-52
The error will be fixed, but the demo shows how XML Support is stopped, and starts again.

There is a work around: we can apply the same logic as restart(), as the need to update vscode-languageclient for the time being

@AlexXuChen AlexXuChen changed the title added xml.restart.language.server command (draft) Added xml.restart.language.server command for language server connection restart Jul 20, 2022
@AlexXuChen AlexXuChen marked this pull request as ready for review July 20, 2022 17:22
@AlexXuChen AlexXuChen requested a review from rgrunber July 20, 2022 17:22
function registerRestartLanguageServerCommand(context: ExtensionContext, languageClient: LanguageClient) {
context.subscriptions.push(commands.registerCommand(ClientCommandConstants.RESTART_LANGUAGE_SERVER, async () => {
// Can be replaced with `await languageClient.restart()` with vscode-languageclient ^8.0.0,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use

await languageClient.restart()

once we move to vscode-languageclient ^8.0.1

Copy link
Member

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

Change works very well for me.

I was considering just leaving the timeout even when run outside of debug mode, but given that restart() will have the timeout, we may as well run it that way.

@rgrunber rgrunber merged commit 2254060 into redhat-developer:master Jul 20, 2022
@rgrunber
Copy link
Member

@AlexXuChen , may be worth adding to https://github.com/redhat-developer/vscode-xml/blob/master/docs/Commands.md as well.

@AlexXuChen AlexXuChen deleted the issue539 branch July 20, 2022 18:25
@AlexXuChen AlexXuChen changed the title Added xml.restart.language.server command for language server connection restart Added xml.restart.language.server command for language server restart Jul 20, 2022
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.

add command "Restart Language Server"
3 participants