alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
GNU General Public License v3.0
1.7k stars 163 forks source link

[FEATURE] - Use new submenu support for editor commands #351

Closed eamodio closed 3 years ago

eamodio commented 3 years ago

image

alefragnani commented 3 years ago

Hi @eamodio ,

Thanks for reporting. I was thinking about embracing this new API, right after it was made public. I just wonder how extensions, and VS Code itself, would deal with it. Would it simply update the extension to use submenus, or should give the user the possibility to choose the appearance, via settings?

Personally, I have mixed feelings. I like direct access to most used context menu items, but I don’t like looong context menus, neither multi-level (more than 2) in context menu.

Just out of curiosity, how are you dealing with GitLens, or VS Code itself. Are you simply moving it to submenus or providing settings ?

Thank you

eamodio commented 3 years ago

I have updated GitLens (in the very soon to be released v11) to take advantage of submenus to considerably reduce the number of items shown -- and so far I've been really happy with the results (I've even used some menu options more than I have in the past). I haven't offered a choice in it (just whether the show the menu items/submenus themselves).

Yeah, its a trade off -- and I would definitely limit it to a single level of submenus (no submenus in submenus).

alefragnani commented 3 years ago

That's great!

Thank you for your feedback 👍

alefragnani commented 3 years ago

Hi @eamodio ,

I just started to work on this, but found an issue that maybe you faced while updating GitLens.

Today I have those entries in that Context Menu. These entries refers to the very main commands of the extension (available in the Command Palette), which as you can see, have keybindings attached. These keybindings are defined by the extension, btw. If the user changes these keybinding, these entries in the Context Menu are updated, as well.

But, If I move these entries to a new Bookmarks submenu, it appears too polluted which the now duplicated Bookmarks: prefix:

image

To solve this, I should contribute new commands, without the Bookmarks: prefix, and use these new commands, instead of the original ones. But now, these new Context Menu items does not show the keybindings (because in fact, they don't have). And I can't simply assign the same keybinding for this new commands, because if the user already customised the original commands, these new entries will be outdated, and new users will have to customize 2 times the same command.

The keybinding itself keeps working, because the original commands are still there, available in the Command Palette, but it feels something is missing, in the Context Menu. The user may think the commands lost/don't have a keybinding.

If I was able to define alternative title for commands, when attached in the Context Menu, I could simply remove the Bookmarks: prefix. Or, if I could make one command reuse the keybinding from another command, it could help too.

Am I missing something?

Thank you

eamodio commented 3 years ago

Sorry for the long delay in getting back to you here.

Since these menu items are now in a submenu labeled Bookmarks, you don't need the Bookmark: prefix, so you can just remove that prefix from the command title. And to keep the prefix in the command palette, add "category": "Bookmark", to each command -- that will "scope" them to that grouping in the command palette.

Hope that helps!