Skip to content
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

Improve vscode handling of local extensions #1438

Closed
ctaintor opened this issue Aug 31, 2024 · 5 comments
Closed

Improve vscode handling of local extensions #1438

ctaintor opened this issue Aug 31, 2024 · 5 comments

Comments

@ctaintor
Copy link

ctaintor commented Aug 31, 2024

Currently vscode will basically just pass through to code --install-extension. This works even if you are installing from a local file. However, the message printed from brew bundle makes it sound like the extension is being installed every time (even though it may just be installing the same file again or updating the installed extension). I'd like this message to be more correct.

So instead of it saying:

Installing /my/extension/filename.vsix

every time, I would want it to say:

Installing my.extension

on the first install and

Upgrading my.extension

The simplest thing I can think of is that the vscode command changes slightly, such that the name is always the extension's identifier – but it could optionally take a local vsix file. e.g.

vscode 'my.extension', filename: '/my/extension/filename.vsix'

Then:

  • the check for the extension being installed would be correct (as in – it would know that my.extension is actually installed)
  • if there is a local vsix file included, then we always call code --install-extension <local-file>
  • the verb would change from "Installing" to "Upgrading" or "Reinstalling or Upgrading"

We could make this more complex by actually reading the vsix file's manifest, getting the version, and only installing if the version from the manifest is different from the version that code responds with if you do code --list-extensions --show-versions. However, not sure that's worth it unless there was a simple command to get the version details. I think the only "easy" way would be if you had vsce installed. Otherwise you're unzipping and reading XML...

(I'm happy to send a PR for this)

@MikeMcQuaid
Copy link
Member

I don't know that your suggested messaging is more correct. To me it should say "Installing" if being fresh installed, "Upgrading" only if upgrading (rather than every time) and "Using" if not installing or upgrading.

If you can make it do all three with relatively minimal code changes: would love a PR. Just adding "Upgrading" as you've described, though, feels no more correct to me given the passthrough.

@ctaintor
Copy link
Author

ctaintor commented Sep 3, 2024

Realistically, I think the only way to actually determine if you were Installing, Upgrading or Using would be to:

  • check if it's installed – if not, the very is "Installing"
  • unzip the .vsix
  • read the package.json – if the version there differs from what vs code says it has installed, use "Upgrading"
  • diff the dirs/files in ~/.vscode/extensions/#{extensionId}-#{version} and the unzipped .vsix. If they differ, use "Upgrading" otherwise use "Using"

@MikeMcQuaid
Copy link
Member

This seems pretty heavyweight for changing a verb that has no functional impact. I think it'd be better to request that code provide some sort of brew outdated equivalent rather than digging into internals.

I'm leaning towards saying we should close this as a WONTFIX, at least given the current state of things.

@ctaintor
Copy link
Author

ctaintor commented Sep 3, 2024

Tend to agree.

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2024
@ctaintor
Copy link
Author

thanks! we ended up doing this ourselves and not using brew bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants