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

Regardless of order, new context menu entries on document show above 'Command Palette'. #43892

Closed
hexnaught opened this issue Feb 17, 2018 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug menus Menu items and widget issues verified Verification succeeded
Milestone

Comments

@hexnaught
Copy link

hexnaught commented Feb 17, 2018

  • VSCode Version: Stable | Jan - 1.20.1
  • OS Version: Windows 10 - V.1709 | Build 16299.192

Steps to Reproduce:

  1. Have extension with commands registered on the document context menu.
  2. Have no x in '{x}_group@{y}' set - appears below 'Command Palette'
  3. Have x in '{x}_group@{y}' set - appears above 'Command Palette', no matter the value.

Does this issue occur when all extensions are disabled?: Yes/No - N/A, Need extension


Even with a ridiculously high group order set, my option appears above the 'Command Palette' 'group'.
"group": "9999999_command@1"

Here is with the group set on the command to 9999999_;

vscode-context-2

And without;

vscode-context-1


I raise this because, I would like my commands to show below the Palette option.

I am using this as a reference, which does not state the group of the Command Palette.
VSCode Extension API - Sorting of groups.

I am unsure if this is more of an issue, or feature request that the 'Command Palette' option is given a group order that can be worked around?

Also to note, even when left out of a group but given an in-group order, they then appear in their own group above the Command Palette option.

@jrieken
Copy link
Member

jrieken commented Feb 26, 2018

Sorting is lexicographical and 9 comes before a or z. Numbers should be used after the @-sign to denote the order inside a group.

screen shot 2018-02-26 at 15 01 03

@jrieken jrieken closed this as completed Feb 26, 2018
@jrieken jrieken added the menus Menu items and widget issues label Feb 26, 2018
@hexnaught
Copy link
Author

@jrieken This does not help with the ability of having my extensions commands appear below the 'Command Palette...' option within the editors context menu.

As per https://code.visualstudio.com/docs/extensionAPI/extension-points#_sorting-of-groups

The editor context menu has these default groups:

  • navigation - The navigation group comes first in all cases.
  • 1_modification - This group comes next and contains commands that modify your code.
  • 9_cutcopypaste - The last default group with the basic editing commands.

Yet none of these contain the Command Palette and thus, no extensions commands can come after/below the command palette option in the context menu, but be ordered via a inside-group order.

Currently, the only way of having a command appear below the command palette option, is to not give it any at all. If you give it either/both a group or inside-group group, the option will appear right above the command palette option as its own group, or in the group order you define prior to the underscore.

This is inconsistent behaviour and does not give us control on ordering extension commands below the command palette option.

Examples;
"group": ""
(Appears below command palette, no commands have ingroup orders)

"group": "@1"
(Appears at the top of my context menu (I don't have any navigation options for the language), has ingroup order, so all of my extensions menu entries can be ordered)

"group": "8_@1"
(Appears above the cutcopypaste group and below modification, as expected. Has in group ordering)

"group": "89_@1"
(Appears above cutcopypaste group still... Driven off first digit? Has in group ordering)

"group": "99_@1"
(Appears below cutcopypaste group but above command palette group... Has in group ordering)

This ordering may be an issue with putting things at the top of the context menu too as according to the docs navigation does not have a {x}_ group order. (None of the navigation commands are showing due to not being implemented for the language we use so I can not verify this).

Out of curiosity and as per your response of '9' > 'z' being false, I tried combinations of 'z_' and '@z' - Still always above the command palette options in the context menu.

Even though it is not a huge issue in terms of functionality as people will get used to where they are, having the ability to completely control the order the context menu between the default options and extension contributions would be nice.

@jrieken jrieken removed the question label Feb 26, 2018
@jrieken jrieken assigned bpasero and unassigned jrieken Feb 26, 2018
@jrieken jrieken reopened this Feb 26, 2018
@jrieken
Copy link
Member

jrieken commented Feb 26, 2018

True. That's because the 'Command Palette...' doesn't define its groups nor an order inside the missing groups. In those cases we append them to the end. This came in via 635ace7 - @bpasero Please define a group et al and update the docs we have around this.

@bpasero bpasero added the debt Code quality issues label Feb 26, 2018
@bpasero bpasero modified the milestones: March 2018, February 2018 Feb 26, 2018
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug and removed debt Code quality issues labels Feb 28, 2018
@bpasero
Copy link
Member

bpasero commented Feb 28, 2018

@jrieken using group id commands now with order 1, let me know if you want another ID.

@jrieken
Copy link
Member

jrieken commented Feb 28, 2018

Hm, maybe prefix a number like 9_commands to make sure this group comes low and to align with others: https://code.visualstudio.com/docs/extensionAPI/extension-points#_sorting-of-groups. The order is just the order of the command in that group, in package.json 9_commands@1

@bpasero
Copy link
Member

bpasero commented Feb 28, 2018

@jrieken shouldn't it be 10_commands then to make sure to be after the cut/copy/paste group?

@hexnaught
Copy link
Author

hexnaught commented Feb 28, 2018

@bpasero That is how I would imagine it should be too, but as per my examples above, "89_@1" was still above "9_" cut/copy/paste group which again contributed to the inconsistent/unexpected behaviour of command ordering.

@hexnaught
Copy link
Author

hexnaught commented Feb 28, 2018

I just gave one of my extensions commands the group 10_commands much like the fix for Command Palette group.

In this case, the only command I am showing is 'Compile Logic' and it is above the cut/copy/paste command section. Maybe internal commands work differently but extensions seem to be driven off the first character only for the main grouping?

image

@jrieken
Copy link
Member

jrieken commented Feb 28, 2018

Yeah, it sort alphabetically... So 10 < 2 etc. Maybe z_commands?

@hexnaught
Copy link
Author

Either that, or 'A' so it is below VSCode internal commands but extensions can have commands in the context menu below it.

@mjbvz
Copy link
Contributor

mjbvz commented Mar 2, 2018

Hey, I tried verifying this but still wasn't able to get a custom command to show below the command palette item. Is this expected? What group ids should I be using to test this?

@hexnaught
Copy link
Author

hexnaught commented Mar 2, 2018

@mjbvz Because the Command Palette was given a group of 'z_commands' you need to give your extension commands a higher grouping for it to appear below the 'Command Palette' group.

For instance I have now given some of my extensions command contributions the group 'z1_' with '@1', '@2' used for their in-group ordering, and they all appear below the Command Palette's 'z' group in the order I want.

(This is on the latest insiders build)

It could be argued that it would be better to have 'a-' assigned to the commands group in which the command palette has been placed, so that extension commands can be given b_ through z_ as their groups if they are required to appear below the command palette option.

@mjbvz mjbvz added the verified Verification succeeded label Mar 2, 2018
@mjbvz
Copy link
Contributor

mjbvz commented Mar 2, 2018

Thanks @JokerDan! Verified this works using that group

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug menus Menu items and widget issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants