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

Add submenu demo #873

Closed
Simon-He95 opened this issue May 31, 2023 · 7 comments
Closed

Add submenu demo #873

Simon-He95 opened this issue May 31, 2023 · 7 comments
Assignees

Comments

@Simon-He95
Copy link

Simon-He95 commented May 31, 2023

image

Right-click to open how to configure the second-level menu, can you add a demo?
For example, the first level is called group, and the second level is expanded after hover, group-item-1, group-item-2

@andreamah
Copy link
Contributor

@andreamah andreamah closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2023
@Simon-He95
Copy link
Author

Hi, @andreamah thanks for your reply, I saw these references, but I still don't know how to set the parent menu and submenu, the image in the content obscures the configured code, I would rather have a simple demo that can run like this.

@Simon-He95
Copy link
Author

Can we move forward with this question? :)

@Simon-He95
Copy link
Author

@aeschli could you please offer a simple demo or update https://code.visualstudio.com/api/references/contribution-points#contributes.submenus to use easier

@Ayyoub-ESSADEQ
Copy link

@Simon-He95 you package contribution points should look something like this :

     "contributes": {
	...,
    "commands": [
      {
        "command": "demo.testCommand1",
        "title": "option 1"
      },
      {
        "command": "demo.testCommand2",
        "title": "option 2"
      },
      {
        "command": "demo.testCommand3",
        "title": "option 3"
      }
    ],
    "submenus":[
      {
        "id" : "submenuId",
        "label" : "Test Submenus"
      }
    ],
    "menus": {
      "editor/context": [
        {
          "submenu": "submenuId"
        }
      ],

      "submenuId":[
        {
          "command": "demo.testCommand1"
        },
        {
          "command": "demo.testCommand2"
        },        
        {
          "command": "demo.testCommand3"
        }
      ]
    }
  },
  ...
 }

Then you will see something like this :

image

@Simon-He95
Copy link
Author

@Simon-He95 you package contribution points should look something like this :

     "contributes": {
	...,
    "commands": [
      {
        "command": "demo.testCommand1",
        "title": "option 1"
      },
      {
        "command": "demo.testCommand2",
        "title": "option 2"
      },
      {
        "command": "demo.testCommand3",
        "title": "option 3"
      }
    ],
    "submenus":[
      {
        "id" : "submenuId",
        "label" : "Test Submenus"
      }
    ],
    "menus": {
      "editor/context": [
        {
          "submenu": "submenuId"
        }
      ],

      "submenuId":[
        {
          "command": "demo.testCommand1"
        },
        {
          "command": "demo.testCommand2"
        },        
        {
          "command": "demo.testCommand3"
        }
      ]
    }
  },
  ...
 }

Then you will see something like this :

image

@Ayyoub-ESSADEQ thanks for you reply, I will try it later

@Simon-He95
Copy link
Author

This is exactly what I was looking for, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants