When using HLSL Tools on MacOS, orphaned ShaderTools.LanguageServer processes will accumulate, wasting memory. This happens after closing and opening VSCode repeatedly. This does not appear to happen on Windows in my experience.
The above GitHub issue details other developers' experiences with the same problem. The solution presented by dbaeumer was to return a Promise from an exported deactivate().
This is confirmed by the above VSCode docs. Extensions with asynchronous cleanup processes must return a Promise from their deactivate(). As LanguageServerClient.stop() returns a Promise, we are obligated to return it when deactivating.
Testing
Tested by copying compilation results from main.ts and session.ts into the existing .vscode/extensions extension folder.
Verified that "Restart Current Session" works as it did previously on MacOS and Windows.
Verified that ShaderTools.LanguageServer processes were stopped after closing VSCode windows and quitting VSCode on MacOS and Windows (even though Windows didn't have this issue).
Description
When using HLSL Tools on MacOS, orphaned ShaderTools.LanguageServer processes will accumulate, wasting memory. This happens after closing and opening VSCode repeatedly. This does not appear to happen on Windows in my experience.
https://github.com/microsoft/vscode/issues/35196#issuecomment-334399348
The above GitHub issue details other developers' experiences with the same problem. The solution presented by dbaeumer was to return a
Promise
from an exporteddeactivate()
.https://code.visualstudio.com/api/references/activation-events#Start-up
This is confirmed by the above VSCode docs. Extensions with asynchronous cleanup processes must return a
Promise
from theirdeactivate()
. AsLanguageServerClient.stop()
returns aPromise
, we are obligated to return it when deactivating.Testing
Tested by copying compilation results from
main.ts
andsession.ts
into the existing.vscode/extensions
extension folder.