Homebrew / homebrew-bundle

📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store.
MIT License
5.36k stars 288 forks source link

Improve `vscode` handling of local extensions #1438

Closed ctaintor closed 2 months ago

ctaintor commented 2 months ago

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:

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 commented 2 months ago

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 commented 2 months ago

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

MikeMcQuaid commented 2 months ago

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 commented 2 months ago

Tend to agree.

ctaintor commented 2 months ago

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