-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Support Platform Specific Extensions #23251
Comments
In your extension activation callback, you are free to check and download extensions as soon as the extension get's activated. This is how Live Share is downloading their dependencies after installation
|
If install dependencies when extension activate, I think it' too later and it maybe cost a long time. |
Idea is to provide a post install hook similar to uninstall hook. This will be executed after an extension is installed or updated. "scripts": {
"vscode:prepublish": "tsc -p ./",
"vscode:install": "node ./out/src/extensionInstall"
"vscode:uninstall": "node ./out/src/extensionUninstall"
}, An extension can install necessary libraries and stuff using this post install script. An unique location per extension is provided through an env variable for the extension to maintain any state. The same location will also be passed with post uninstall script. |
I would prefer a better name. Today |
@sandy081 Thanks for pointing this feature out to us on the C# extension. Our dependency downloading story is actually a little complicated. Each version of the extension ships with built in URLs to specific versions of binary dependencies, and, if the user has no options set, we'll download them on first run. However, we allow users to control what version of our dependencies they download. You can see this in action by playing with the option "omnisharp.path". If you:
Basically, we need to be able to access our "unique location per extension" after install-time to read and write values. Would the new API support that? |
@sandy081 In addition to what Ravi said, I would first off like to say a thanks. I have been wanting this feature for so long. So I am very excited to see it happening! Two other notes --
Here is the C# extension "download dependencies" code as a reference:
|
Going with |
Thanks for your feedback. Post install script will be given access to a unique location per extension (not per version). This location is provided to the script through process environment variable I do not think this script will be given access to configuration API. So if you have user configurable versions, then you can download the specific version during run time by checking in the above location.
Post install step runs as part of extension installation, so the extension installation progress in the extension view shows it. Logs show what step (eg: post install) is being running now.
I am completely aware of this and we are working to come up with a solution for this. Hence not including this here. Let me know if this helps. |
So you are saying that extensions will only have access to the per-extension location? If so, I would suggest changing the design to allow extensions to install to either place. Alternatively, if the 'DownloadFiles' API was really more a dependency management API where VS Code took care of removing outdated dependencies along with downloading the new ones, that could definitely work.
Are you saying it will only show that it is on the 'post install' step and give no more granular progress than that? Or are you saying it will show that it is on the 'post install' step, and there will be some ability to see with more detail (ex: click on that to bring up an output window pane). If the former, I don't think that will be good enough unless the forthcoming 'DownloadFile' API solves this problem. |
BTW: I would like to throw out one other idea here. Instead of designing a bit of code that needs to run, really the missing feature here is that extensions can't tell VS Code about all of their platform-specific dependencies. So another way to solve this would be to make post-install hooks a feature that is normally implemented with a tiny bit of javascript that just returns (ex: by writing JSON to stdout) the set of packages that the extension needs. This way extensions don't need to all maintain a bunch of code to do this, VS Code can hopefully just reuse most of the existing extension download and extension file management code, and VS Code doesn't need to allow any of its normal APIs to work in these post-install hooks. Example of how an extension might declare its dependencies:
|
+1 to @gregg-miskelly's idea above of making it declarative. An additional benefit of this could be that these dependencies could also be cached in the temp folder. That way, if the extension has a newer version but the dependencies don't change (like for LiveShare where we download .NET Core), then the update could be much faster as we'd just reuse the cached download on that machine. |
I do not agree letting the platform (VS Code) to do the dependency or resource management for the extensions is the right approach. It is hard for the platform to understand and provide an API that will fulfil all kinds of resource management requirements. Hence such an extension point will be incomplete always. So, I think extensions are the right ones to do their dependencies management and we provide a location where you can cache them and maintain the state. I see that the dependencies approach is trying to solve following problems
I agree as an an end user it is important to know
If user wants to know more about what is happening during post installation, user can see it in the logs. It's same with extension installation that the shared process log captures all details. One idea is that post install scripts logs their activity and VS Code show a status bar entry showing
I think this is a general issue and exposing the dependencies API will not help all cases. As said, we are working on it to provide a general solution that helps in all cases. |
@sandy081 I think your statement above is true if you look at the 100% case, but there is a lot of value to be gained in solving the 80-95% case. I think you might find that the declarative API described by @gregg-miskelly might meet the majority of cases. Offline of this thread we have multiple discussions with @kieferrm and @egamma about this and I believe that the general consensus was that there would be value in providing something like this out of the box. I do agree that there are some underlying issues here (i.e. showing progress in a common way, proxy support, etc) but thats part of the reason that this issue exists. Lastly, to help get the declarative API to the point where it supports more cases, I don't see why there couldn't be strategic callbacks that people can tap to help direct things. |
@avanderhoorn If I am not wrong the reason for downloadable resources extension point proposal was to overcome the proxy issue otherwise the post install script extension point is the better way for the extensions to download / manage resources. Also, this resources extension point is not a complete and generic solution as this will not help extensions if they want to download during run time. Again, we are doing some investigation and research on how to provide a generic solution for proxy issues. If that yields positive results the resources extension point might be redundant. |
Tagging for |
@sandy081 What's the rationale for providing a post-install script file as opposed to a javascript callback (as @gregg-miskelly suggested)? If extensions provide a post-install callback that calls a standard VS Code downloading API, you can make progress reporting very consistent. |
@rchande post-install script is going to be a node script that gets executed after installing the extension. VS Code API is available only for running extensions and hence the newly installed extension does not has access to it as it is not running. A new API has to be defined if post-install script wants to show some UI elements which we want to avoid. Summarising the discussion: Proposal: Post Install Script
Proxy Issues
Proposal: Resources Contribution PointGiven that Proxy issue is being investigated and if we arrived to a generic solution, Post Install Script option is a better solution. Please let me know if this makes sense or are there any changes suggested? |
No, the universal and platform versions cannot coexist for the same version of an extension
Is this for same version of an extension? Can you give an example, please?
Yeah this looks like a bug. Could you file it on |
@tboby @testforstephen @Eskibear thanks for giving this a try and for providing feedback 👏 We do not recommend to have platform specific vsix and universal vsix for the same version. Instead we recommend that for a version an extension would publish a platform specific package for each platform (even if vsix is shared across different platforms). If this is too much manual work let us know (we are already looking into improve the flow in Only @Eskibear issue was not covered by Prashat: @sandy081 is working on a fix and will probably push a fix for this soon. |
Thanks so much for implementing this. I am very excited! Two questions:
|
I think it's the case. For example, I use Semantic Release to manage the versioning of the ShellCheck extension through semantic-release-vsce. I cannot even think of a way of handling two versions at once for the platform specific and not platform specific extension with Semantic Release. Not to say that having two different versions for the same codebase is a bit misleading. Ideally the "universal/non-platform-specific" should have the same version, so that the Git tag that we create for each release would reflect the true for both cases. Also, there is the CHANGELOG maintenance. Having to update two entries, as the versions will differ is also cumbersome. |
Thanks for feedback. Fixed following:
|
@felipecrs this is why we recommend automating this flow. Though we will also try to improve the manual flow as well. I will keep you updated. Thanks for feedback. |
I would also think it would be a good idea to offer up a "generic" platform that's a fallback if you haven't published the right one. I don't think it's good for extensions to have to keep track of every platform VS Code could support (present and future) and ensure they publish versions for each of them. There's always the case that a new platform (say, darwin arm64) appears, then some older extension can no longer be used because it won't be installed unless you have the platform available. But, I know this (and the insiders versioning) is sort of limited by what the marketplace can do. |
@jakebailey this is a good suggestion, however we are a bit limited due to marketplace support. |
Thanks. For the C# extension, have one platform (darwin-arm64) where we are fairly close to the limit -- 198425276 bytes (189.2 MB) in my quick test. I can do some experiments to see if we can reduce this a bit. But we have have an ask to raise this slightly. |
@gregg-miskelly ok, so it seems like we are good for now but I have notified the Marketplace that we would like to increase the size limit. Once they do that I will let you know. |
As I mentioned above Thus I am closing this issue. If there are questions feel free to ask, we will continue monitoring this issue even though it is closed. Thank you very much 👏 |
Just a question, because I didn't understand, was the thing about having to release different versions for non-platform specific and platform specific extensions solved? I.e. can I release a |
@felipecrs yes you can, but you need to publish your |
@isidorn thank you! |
@isidorn When Marketplace increases the size limit, is this announced in this issue or in another? Or is this documented somewhere? I can't find the info about the 200MB anywhere else than here (the previous limit of 100MB is also hard to find, it's buried in some old release notes of VS Code). Whether it's 200MB or say 250MB or 300MB makes a big difference for my extension with respect to migrating to platform-specific extensions, but I don't know a way of finding out the current limit other than trying to publish and see what happens. Obviously, at that point, a lot of effort has been invested, in vain if the limit is lower than expected. |
@valentjn The size limit is not documented anywhere. Right now, we have 200MB limit, however we allow larger extension on need bases. |
PS: I opened an issue to VS Marketplace to support |
I can't find answer from stack overflow, so I open a issue.
The text was updated successfully, but these errors were encountered: