Skip to content

menu bar extensions - #7704

Merged
Johannes Rieken (jrieken) merged 16 commits into
masterfrom
joh/menus
Jun 16, 2016
Merged

Johannes Rieken (jrieken) merged 16 commits into
masterfrom
joh/menus

Conversation

@jrieken

@jrieken Johannes Rieken (jrieken) commented Jun 15, 2016 •

Copy link
Copy Markdown
Contributor

The PR is the start to implement #3192 by allowing extensions to add primary and secondary actions to the editor action bar. The approach we take will also allow to add action in other places, like viewlets or context menus.

The current thinking goes like this: In the commands contribution point will get an additional context property (better name to be found) that allows to define where to show the command under what condition.

{
    "command": "v.sayHello",
    "title": "Hello World",
    "icon": "./media/Preview.svg",
    "context": {
        "where": "editor/primary",
        "when": "typescript"
    }
}

The sample above makes the command show up in the primary editor tool bar when it shows a typescript file. The path will be a finite enumeration of locations, like editor/primary, editor/secondary, explorer/primary etc. The when condition is the trustworthy DocumentSelector always being applied on an Uri.

The big concern is UI scalability wrt the amount of actions/menu entries accumulating over time. I don't think being restrictive is the right approach but we should give users the change to customise menus like we allow to customise keybindings. Customisation from extensions should be treated as proposed customisation which the user accepts or denies. Analog to keybindings, there should be a file like menus.json which allows to manually change the menu layout.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants