microsoft / VSExtensibility

A repo for upcoming changes to extensibility in Visual Studio, the new extensibility model, and language server protocol.
MIT License
362 stars 45 forks source link

Easy way to add CanonicalName to Command? #413

Open Confuset opened 3 weeks ago

Confuset commented 3 weeks ago

Hey everyone, i currently struggle to find a way to add a CanonicalName to a Command like it was possible using VSCT files in the old VSix Packages. Am I missing something?

RyanToth3 commented 1 week ago

The concept of CanonicalName doesn't exactly exist in the new Extensibility model. What are you interested in doing that requires a CanonicalName?

Confuset commented 1 week ago

What I am trying to do is have a command registered that I could call from the Command Window in VS or define Shortcuts using the VS builtin "Keyboard" Dialog. Something that can be called like MyExtension.Command1 MyExtension.Command2 etc. I know that I can use
Shortcuts = new[] { new CommandShortcutConfiguration(...) } But that forces me to predefine the Keybind and the user can not change this.

RyanToth3 commented 1 week ago

Keyboard customizations for commands that are created using the new extensibility model are not supported yet. Also, executing these commands from the Command Window is not supported and is most likely something we won't be implementing.

However, all commands defined through the new model are automatically discoverable through the All-In-One Search feature in Visual Studio which is something that was not possible with VSCT based commands in the old model: https://devblogs.microsoft.com/visualstudio/new-better-search-in-visual-studio/

Confuset commented 1 week ago

That is unfortunate and probably renders this SDK unuseable to me. But let me be more specific: I use the extension vsvim to have some sort of vim-feeling in VS and I wanted to use an extension to further enhance vsvim by defining some bindings to commands. In order to so, I need a canonical name to call the commands from within vsvim.

tinaschrepfer commented 1 day ago

@Confuset - As @RyanToth3 mentioned, keyboard customization for VisualStudio.Extensibility style commands is not something we support at the moment. However, adding the ability to do so is on our roadmap to be done in the future. Regarding executing VisualStudio.Extensibility commands from the Command Window, while that is not supported, these commands can be executed through the All In One Search window. We haven't polished that experience yet and will be improving it going forward.

Regarding direct invocation of commands (specifically VSCT-based commands), we actually made an intentional decision to not support it. You can read about why that is the case in our latest blogpost here: https://devblogs.microsoft.com/visualstudio/visualstudio-extensibility-17-11-settings-and-more-remote-ui-support/. However, I'd like to understand your scenario with calling commands within vsvim a bit more to see if we might be able to help you do it another way. Can you share an example scenario of what you're trying to do?