Open o-l-a-v opened 1 month ago
Thanks for the report. @andyleejordan being able to restart the extension host without restarting all of vscode is a new feature, and I'm not exactly sure how the cleanup/teardown works but I'm guessing we need to add a teardown step for the extension or probably a disposable that makes sure to clean up the extension terminal.
EDIT: Also FWIW I could reproduce even when not upgrading, just running restart extension host
Yeah, we have logic setup to handle tear down...but those handlers actually need to fire. This is the main one:
If the extension host is being restarted, I assume that means our handler can't fire, which would result in this behavior. We'll have to look into if there are any like "deactivate" hooks to implement.
@andyleejordan you probably need to register onTerminalClose
as a disposable to the context.subscriptions
of the extension context array. Alternatively we can just implement a deactivate
method at the root level.
https://code.visualstudio.com/api/get-started/extension-anatomy#extension-entry-file
Sooo as far as I can tell all those things are wired up correctly. I think disposing a Terminal
object from within the extension doesn't actually kill that terminal (which is very weird but I'm watching dipsose()
get called and the terminal just sitting there alive and well). VS Code handles kililng them all on reloadWindow
but it's specifically not killing them on restartExtensionHost
. I'm seeing if @Tyriar has any idea how we can manually kill a terminal on deactivation of the extension.
I think what's probably happening here is dispose
is being called but it's a sync call and the request may not be able to complete as it requires a round trip to the renderer process:
Renderer:
Calls ext host:
@andyleejordan could you dispose the terminal/do the clean up after the restart happens?
Prerequisites
Summary
In VSCode, if updating any VSCode extension, then push the "restart extensions" button,
vscode-powershell
fires up a new terminal without killing the running one.https://github.com/PowerShell/vscode-powershell/assets/6450056/7d366ac4-b6a2-401f-a032-b4caeadfb3a5
PowerShell Version
Visual Studio Code Version
Extension Version
Steps to Reproduce
"powershell.startAutomatically": true
could be relevant here?Visuals
Logs
No response