-
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
[cli] Keep downloaded .vsix plugins as they are #7093
Conversation
Keep the vs code extensions in their original .vsix format. This should make it possible for the plugins folder and contained extensions to work even if they are read-only, even if one or more extension writes inside their own folder at runtime, like e.g. the Java extension by Red Hat does. Concretely this will permit packaging Electron Theia applications along with a set of VS Code extensions considered "default", like the builtins and other wanted extensions. Most operating system packagers install the packages globally on a machine, and have the files writable only by root. By keeping the .vsix in their original format, they will, at app startup, be unzipped in the host's temporary folder under ownership of the current user and so be writable by them. This way, if any extension writes to its own folder, it will not fail. Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
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 look good to me, I've verified that:
- the plugins are kept in
.vsix
form when callingyarn download:plugins
. - the plugins still work correctly (ex:
vscode-builtin-npm
contributes a view to the Explorer). - the already downloaded plugins are skipped properly.
- the above mentioned checks work correctly in Electron as 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.
ok. they'll expanded later but then we see files instead of folders in plugins folder
Yes, that's correct. They'll be expanded when the Theia application starts, saved under /tmp/vscode-unpacked/ . |
Thanks for the review @vince-fugnitto and @benoitf - merging |
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.
Tested on Ubuntu 18.04
Keeping the file as ".vsix" allows to build an AppImage with JAVA and to run OK with the language server which tries to write to the plugin. If we unzip the plugins before, running an AppImage with JAVA did not execute properly with the language server since the permission were set to "read only" for the end-user.
Works nicely
Thanks @marcdumais-work
It is significantly increased deployment time around 10x from 300ms to 3s. We should rather work on keeping all extracted extensions in one place under user product directory and let this script to extract it there at build time. I hope the code doing such extraction can be reused between plugin-ext and script. |
Sounds about right. This should happen only the first time however, afterwards the
Can you clarify what you mean by "user product directory"? We encountered an issue when packaging an Electron app: the app and extracted extensions are read-only for all but most primitives packagings (.tar.gz), and we found at least one extension that relies on creating files/folders under itself: Red Hat Java. AppImage format is really interesting/convenient on Linux, but all the content is read-only / static - even playing with permissions I do not think we can change that. @vince-fugnitto suggests we could have the script unpack the extensions by default but have the option to leave them as .vsix if wanted (update: I see you suggest the same thing on a theia-apps PR so it looks like a good way forward) |
@marcdumais-work I mean for instance there is a Theia product based |
Sounds good.
Does that imply that the "default" extensions (defined in
+1 |
I thought this script could be moved to be a binary exposed by the plugin-ext package to reuse installation code, and then we call run installation at build time to avoid any unpacking on first start. |
What it does
With this patch the downloaded VS Code extensions are kept in their original .vsix format. This should
make it possible for the plugins folder and contained extensions to work even if they are read-only, even if one or more extension writes inside their own folder at runtime, like e.g. the Java extension by Red Hat does.
Concretely this will permit packaging Electron Theia applications along with a set of VS Code extensions considered "default", like the builtins and other wanted extensions. Most operating system packagers install the packages globally on a machine, and have the files writable only by root. By keeping the .vsix in their original format, they will, at app startup, be unzipped in the host's temporary folder under ownership of the current user and so be writable by them. This way, if any extension writes to its own folder, it will not fail.
How to test
$> yarn
Then verify the content of the
plugins
folder. The downloaded extensions should be in the.vsix
format rather than unzipped.Run the example applications and confirm that plugins are detected and work like before
Review checklist
Reminder for reviewers