swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
708 stars 47 forks source link

Dispose LSP's output channel on restart #841

Closed plemarquand closed 4 weeks ago

plemarquand commented 4 weeks ago

When restarting SourceKit-LSP its output channel was not disposed, which caused a new entry to be added to the output channel list without removing the old one.

Fixes #839

adam-fowler commented 4 weeks ago

This is kind of dodgy, in that we are assuming the VSCode language client never calls the dispose on the outputChannel. Looking through the language client code it should be calling it, so I am a little confused as to why this call is needed. https://github.com/microsoft/vscode-languageserver-node/blob/0226f6cd925d279dda2b777d25c5b69518ac0035/client/src/common/client.ts#L1414

plemarquand commented 4 weeks ago

After some digging I understand what is happening here, and it does seem to be a bug in vscode-languageclient. The flow is:

This leaves us with one more output channel than we started with.

adam-fowler commented 4 weeks ago

After some digging I understand what is happening here, and it does seem to be a bug in vscode-languageclient. The flow is:

Do you want to add an issue for the vscode language client? Oh and add a comment here detailing the issue and that it should be reverted once a fix is in vscode-language-server

plemarquand commented 4 weeks ago

Sounds good, I'll create that issue once I have received internal approval and link it back to here.

plemarquand commented 3 weeks ago

Created https://github.com/microsoft/vscode-languageserver-node/issues/1496 to track the root cause in vscode-language-server-node.