Skip to content

PSES needs to shutdown itself when it's supposed to #655

Closed
@TylerLeonhardt

Description

@TylerLeonhardt

Ok everyone, I did some research and here's what I've found:

Right now, the client kills the server process.

The proof can be found here in the VSCode client: https://github.com/PowerShell/vscode-powershell/blob/master/src/process.ts#L145-L161

That said, this is not a good thing.

You might be wondering... The LSP has both a shutdown and an exitmessage, don't we implement those?

The answer is yes.......... but it's functionally a no-op 😢

You can see the TODOcomment here:
https://github.com/PowerShell/PowerShellEditorServices/blob/master/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs#L148

which is referring to this TaskCompletionSource that is causing the process to stay open:

this.serverCompletedTask = new TaskCompletionSource<bool>();

All we need to do is pass that TaskCompletionSource into the handler and complete the source when an exit event is received (possibly when there are 0 connections)

P.s. big thanks to @SeeminglyScience for helping me investigate this! 😄

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions