You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extension needs to be notified when it gets uninstalled #35006
When an extension is uninstalled, it needs to be notified of the uninstall event and do some cleanup before it is removed.
Here's the scenario. We have extension B which register some Java component in extension A. So when B is uninstalled, we would like to unregister B from A. Otherwise, A would attempt to load B's Java component in the next run, when B is already removed.
In our case, A is the Java Language Support from RedHat. B is the new Java debugger from Microsoft. Both ship Java artifacts which contain the real logic. So it's very important for the registration/unregistration to happen correctly.
changed the title [-]Extension needs to be notified when it gets uninstalling[/-][+]Extension needs to be notified when it gets uninstalled[/+]on Sep 26, 2017
Rome Li (@akaroml) Not sure why do you need to Uninstall listener here. Actually when an extension depends on another extension, you can add it as a dependency in extensionDependencies section of package.json. Dependent extension should not bother about the depending extensions existence or not. It should be other way round. We also make sure if an extension is uninstalled, we do not uninstall it if there is an extension depending on it.
It looks to me that in your case B depends on A and A wants to do some clean up when B is uninstalled. This is showing some cyclic dependencies.
This issue has been closed automatically because it needs more information and has not had recent activity. Please refer to our guidelines for filing issues. Thank you for your contributions.
I have a different use case but the same request for an uninstall life-cycle hook/event. I have an extension that needs to clean up some dirs/files it creates on the OS when uninstalling but should leave alone if simply deactivating (closing a vscode instance).
Now you can provide node script (javascript) to run after the extension is uninstalled, using the property vscode:uninstall under the scripts property in package.json.
Sandeep Somavarapu (@sandy081) "Using this hook, you can clean up the stuff that your extension has created." I can't clean up vs code user settings on that hook. In my case, i add some settings. It says that it can not find 'vscode' module when that hook runs. Should i go the user.settings path and modify with plain node js?
Activity
[-]Extension needs to be notified when it gets uninstalling[/-][+]Extension needs to be notified when it gets uninstalled[/+]sandy081 commentedon Sep 26, 2017
Rome Li (@akaroml) Not sure why do you need to Uninstall listener here. Actually when an extension depends on another extension, you can add it as a dependency in
extensionDependenciessection ofpackage.json. Dependent extension should not bother about the depending extensions existence or not. It should be other way round. We also make sure if an extension is uninstalled, we do not uninstall it if there is an extension depending on it.It looks to me that in your case B depends on A and A wants to do some clean up when B is uninstalled. This is showing some cyclic dependencies.
Martin Aeschlimann (@aeschli) FYI
vscodebot commentedon Oct 3, 2017
This issue has been closed automatically because it needs more information and has not had recent activity. Please refer to our guidelines for filing issues. Thank you for your contributions.
Luiz-N commentedon Oct 9, 2017
I have a different use case but the same request for an uninstall life-cycle hook/event. I have an extension that needs to clean up some dirs/files it creates on the OS when uninstalling but should leave alone if simply deactivating (closing a vscode instance).
sandy081 commentedon Oct 10, 2017
Makes sense
sandy081 commentedon Jan 9, 2018
Related #14444
sandy081 commentedon Feb 21, 2018
Now you can provide node script (javascript) to run after the extension is uninstalled, using the property
vscode:uninstallunder thescriptsproperty inpackage.json.Example
Using this hook, you can clean up the stuff that your extension has created.
GabrielBB commentedon Mar 11, 2018
Sandeep Somavarapu (@sandy081) "Using this hook, you can clean up the stuff that your extension has created." I can't clean up vs code user settings on that hook. In my case, i add some settings. It says that it can not find 'vscode' module when that hook runs. Should i go the user.settings path and modify with plain node js?
sandy081 commentedon Mar 12, 2018
Gabriel Basilio (@GabrielBB) Yes, this hook does not provide you access to vscode api. Please create a new feature request for that.
Fix microsoft#35006