-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement safe plugin uninstallation #11084
Implement safe plugin uninstallation #11084
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
However, I noticed something which didn't work as described in the testing steps. "Installing" an extension by unzipping it into ~/.theia
and starting the app did not copy the extension into the /tmp/vscode-unpacked
directory (with and without the --uncompressed-plugins-in-place
flag). It did work for zipped (.vsix
) extensions as expected. Is that something I got incorrect?
Aside from that I noticed that every uninstalled extension now requires to reload before disappearing completely. While this is definitely an improvement to the way it worked previously, vscode seems to be able to decide on a case-by-case basis whether uninstalling an extension requires an app reload. But this is probably something for another PR :)
packages/plugin-ext-vscode/src/node/plugin-vscode-directory-handler.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/node/plugin-uninstallation-manager.ts
Outdated
Show resolved
Hide resolved
@msujew, thanks for taking a look!
It should be copying all directories from the user folder. You said you unzipped into the
I have an idea for this, but it's harder to guarantee on the backend than the frontend, so I've left it for later :-). |
96b3fa2
to
7a59699
Compare
@colin-grant-work There is a typo on the instructions at the top, it should be |
Good catch. I've also fixed this behavior. @msujew, it looks like during a rebase, the actual call to copy VSCode plugins got deleted; I've brought it back in this commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested the following scenarios and they work fine! 👍
- Tested deployment of folders to a 'tmp' directory
- Tested loading of plugin folders in place via
--uncompressed-plugins-in-place
flag - Uninstallation without undeployment for .vsix
- Uninstallation without undeployment for uncompressed folder extensions
- Uninstalling and installing a different version
I am not too familiar with the code base, so I will let more experienced committers in the area to cover it.
I found a typo and mentioned it as an inline comment.
@tsmaeder, it might be good to have a Red Hat perspective on this, since it makes substantial changes to the way we pass around data about plugins - changing and making explicit expectations about whether versions are included as part of identifiers - and adds some state that we didn't have before. Want to make sure that we don't blow up Che, if they're still updating the version of Theia they offer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes work well for me 👍
I confirmed that:
- extensions can be searched.
- extensions can be installed.
- extensions can be uninstalled.
- uninstalled extensions require a
reload
before they are removed. - upon reloading the application extensions can be re-installed.
- if an extensions is uninstalled, multiple clients will be notified and display
reload required
. - if an extension is uninstalled, and installed through
install from vsix
the proper extension versions is used on reload. - deployment of extensions works well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconfirming my approval. With the latest changes putting an unzipped extension into the ~/.theia/plugins
folder copies it to the /tmp/vscode-copied
directory and activates it correctly. The behavior for the flag also works as expected 👍
@tsmaeder, last call here. I'll merge tomorrow if there are no objections. |
@@ -24,7 +24,7 @@ import { CancellationToken, CancellationError, cancelled } from './cancellation' | |||
*/ | |||
export class Deferred<T = void> { | |||
state: 'resolved' | 'rejected' | 'unresolved' = 'unresolved'; | |||
resolve: (value: T) => void; | |||
resolve: (value: T | PromiseLike<T>) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that Deferred
should support resolving to promises, but this introduces a bug where we may resolve to an unresolved PromiseLike
but we will mark the Deferred
as resolved too early.
Consider the following change:
export class Deferred<T = void> {
state: 'resolved' | 'rejected' | 'unresolved' = 'unresolved';
resolve: (value: T | PromiseLike<T>) => void;
reject: (reason?: unknown) => void;
promise: Promise<T> = new Promise<T>((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
}).then(
value => { this.state = 'resolved'; return value; },
error => { this.state = 'rejected'; throw error; }
);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand I could be misunderstanding the role of the state
property?
Is it meant to represent when resolve
has been called, or when the underlying promise resolves? Doesn't look obvious.
c140b15
to
fc7ae12
Compare
Thanks everyone who reviewed! |
@colin-grant-work would have loved to chime in, but no time, unfortunately 🤷 |
What it does
This PR implements several things:
~/.theia/extensions
directory--uncompressed-plugins-in-place
flag in the CLIHow to test
Review checklist
Reminder for reviewers