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

Extension's view/title menu entry contributions are sometimes grouped incorrectly #54308

Closed
hbenl opened this issue Jul 14, 2018 · 12 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug menus Menu items and widget issues verified Verification succeeded

Comments

@hbenl
Copy link

hbenl commented Jul 14, 2018

  • VSCode Version: 1.25.1 (also tested with the lates insiders release)
  • OS Version: Arch Linux x64

I have some view/title menu item contributions in my package.json:

        {
          "command": "test-explorer.enable-autorun",
          "group": "1_autorun@1",
          "when": "view == test-explorer"
        },
        {
          "command": "test-explorer.disable-autorun",
          "group": "1_autorun@2",
          "when": "view == test-explorer"
        },
        {
          "command": "test-explorer.retire",
          "group": "2_state@1",
          "when": "view == test-explorer"
        },
        {
          "command": "test-explorer.reset",
          "group": "2_state@2",
          "when": "view == test-explorer"
        }

This results in the menu items being grouped incorrectly:
screenshot_2018-07-14_15-38-15

There is a workaround: if I change the group properties from 2_state@1 to 2_state@3 and from 2_state@2 to 2_state@4, it works as expected:
screenshot_2018-07-14_15-42-32

So it looks like this only occurs when there are menu items in different groups that have the same item sorting index.
Note also that I have only seen this bug in view/title contributions whereas view/item/context contributions work flawlessly.

@vscodebot
Copy link

vscodebot bot commented Jul 14, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@hbenl
Copy link
Author

hbenl commented Jul 14, 2018

That's not a duplicate of this issue.

@isidorn isidorn assigned sandy081 and unassigned isidorn Jul 16, 2018
@sandy081 sandy081 added this to the July 2018 milestone Jul 16, 2018
@sandy081 sandy081 modified the milestones: July 2018, August 2018 Jul 27, 2018
@sandy081 sandy081 added the tree-views Extension tree view issues label Aug 28, 2018
@sandy081
Copy link
Member

Forwarding to @jrieken as it is related to menu

@sandy081 sandy081 removed this from the August 2018 milestone Aug 29, 2018
@sandy081 sandy081 assigned jrieken and unassigned sandy081 Aug 29, 2018
@sandy081 sandy081 removed the tree-views Extension tree view issues label Aug 29, 2018
@jrieken jrieken added the info-needed Issue requires more information from poster label Aug 29, 2018
@jrieken
Copy link
Member

jrieken commented Aug 29, 2018

I cannot reproduce. Please provide more information so that I can reproduce this locally.

screen shot 2018-08-29 at 16 38 49

@hbenl
Copy link
Author

hbenl commented Aug 29, 2018

It looks like you tried this with a view/item/context contribution, which doesn't have this bug. Try it with a view/title contribution.

@jrieken
Copy link
Member

jrieken commented Aug 29, 2018

That's true. I can reproduce there.

@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug menus Menu items and widget issues and removed info-needed Issue requires more information from poster labels Aug 29, 2018
@jrieken
Copy link
Member

jrieken commented Aug 29, 2018

My part here works correctly, the fillInAction...-function works proper (see screenshot). This must get scrambled downlevel, e.g when merging with legacy actions or so.

screen shot 2018-08-29 at 17 48 48

@jrieken
Copy link
Member

jrieken commented Aug 29, 2018

The ViewletPanel#setActions method seems to be called with the wrong data. Someone on the way it gets broken, my suspect is prepareAction which is always doing some funky resort.

screen shot 2018-08-29 at 17 51 51

@jrieken jrieken assigned sandy081 and unassigned jrieken Aug 29, 2018
@sandy081 sandy081 added this to the August 2018 milestone Aug 30, 2018
@sandy081
Copy link
Member

@bpasero prepareActions is messing up the order.

@sandy081 sandy081 removed their assignment Aug 30, 2018
@bpasero bpasero removed this from the August 2018 milestone Aug 30, 2018
@bpasero bpasero added this to the September 2018 milestone Aug 30, 2018
@bpasero
Copy link
Member

bpasero commented Aug 31, 2018

@hbenl can you share the full package.json with the view contribution and the commands etc. so that I can reproduce?

@bpasero bpasero added the info-needed Issue requires more information from poster label Aug 31, 2018
@jrieken
Copy link
Member

jrieken commented Aug 31, 2018

There you go @bpasero

{
	"name": "virtual",
	"displayName": "Virtually Testing",
	"description": "Balbababababab",
	"version": "0.0.2",
	"publisher": "jrieken",
	"engines": {
		"vscode": "^1.23.0"
	},
	"categories": [
		"Other"
	],
	"activationEvents": [
		"onFileSystemAccess:foo",
		"onFileSystemAccess:mem",
		"onView:fooTree",
		"*"
	],
	"main": "./out/extension",
	"enableProposedApi": true,
	"contributes": {
		"views": {
			"explorer": [
				{
					"id": "fooTree",
					"name": "Foo Tree"
				}
			]
		},
		"snippets": [
			{
				"language": "abc",
				"path": "./snippets/abc.json"
			},
			{
				"path": "./snippets/super.code-snippets"
			}
		],
		"languages": [
			{
				"id": "json2",
				"aliases": [
					"JSON2"
				],
				"extensions": [
					".json2"
				]
			},
			{
				"id": "foo",
				"aliases": [
					"foolang"
				],
				"extensions": [
					".foo"
				]
			},
			{
				"id": "foobar",
				"aliases": [
					"Foobar"
				],
				"extensions": [
					".foobar"
				]
			},
			{
				"id": "barfoo",
				"aliases": [
					"Barfoo"
				],
				"extensions": [
					".barfoo"
				]
			},
			{
				"id": "abc",
				"extensions": [
					".abc"
				],
				"configuration": "./abc.language-configuration.json"
			}
		],
		"commands": [
			{
				"command": "extension.sayHello",
				"title": "Hello World & Welt"
			},
			{
				"command": "extension.sayHello1",
				"title": "test-1"
			},
			{
				"command": "extension.sayHello2",
				"title": "test-2"
			},
			{
				"command": "extension.sayHello3",
				"title": "test-3"
			},
			{
				"command": "extension.sayHello4",
				"title": "test-4"
			}
		],
		"menus": {
			"commandPalette": [
				{
					"command": "extension.sayHello"
				}
			],
			"view/title": [
				{
					"command": "extension.sayHello1",
					"group": "1_autorun@1",
					"when": "view == fooTree"
				},
				{
					"command": "extension.sayHello2",
					"group": "1_autorun@2",
					"when": "view == fooTree"
				},
				{
					"command": "extension.sayHello3",
					"group": "2_state@1",
					"when": "view == fooTree"
				},
				{
					"command": "extension.sayHello4",
					"group": "2_state@2",
					"when": "view == fooTree"
				}
			]
		},
		"keybindings": [
			{
				"key": "cmd+j",
				"command": "extension.sayHello"
			}
		],
		"configuration": {
			"properties": {
				"foo.bar": {
					"type": "string"
				},
				"extension.setting": {
					"type": "string",
					"default": "Grüezi"
				},
				"properties": {
					"testExtension.object": {
						"default": null,
						"type": "object",
						"properties": {
							"field": {
								"default": "hello",
								"type": "string"
							}
						}
					}
				}
			}
		},
		"configurationDefaults": {
			"[python]": {
				"editor.suggestSelection": "first"
			}
		},
		"problemMatchers": [
			{
				"pattern": [
					{
						"regexp": "^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$",
						"file": 1,
						"location": 2,
						"message": 3
					}
				]
			}
		]
	},
	"scripts": {},
	"devDependencies": {
		"typescript": "2.5.3",
		"vscode": "1.1.5",
		"@types/node": "8.0.31"
	}
}

@jrieken jrieken removed the info-needed Issue requires more information from poster label Aug 31, 2018
@jrieken
Copy link
Member

jrieken commented Aug 31, 2018

And I'd put my money on this being the order-patching

@bpasero bpasero closed this as completed Sep 3, 2018
bpasero added a commit that referenced this issue Sep 3, 2018
@roblourens roblourens added the verified Verification succeeded label Sep 26, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 18, 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

6 participants