Skip to content

Problems: Convert hardcoded tree actions to configurable commands #20420

@bpasero

Description

@bpasero

When you take a look at the controller in https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/markers/browser/markersTreeController.ts#L27 there are a bunch of hardcoded keybindings associated for certain actions. We should avoid this and rather introduce commands that the user can associate keybindings with.

As part of #11517 I introduced a new service IListService that every tree is registering to. This service tracks focus of the tree and enables a listFocus context key whenever the tree has focus. As part of the register method you can pass over additional context keys that you want to have set for your domain (e.g. problemsFocus). E.g. the "Open Editors View" is doing that here.

I suggest to write new commands that are enabled in the context for the domain (e.g. problemsFocus) and remove the hardcoded keybinding handling in the tree controller. When doing so I would pick short and descriptive command Ids (e.g. problems.something over workbench.action.problems.something).

If you need to overwrite a certain keybinding that already exists from the list service (e.g. Space should do something else than toggling), you can give your command a higher weight (see for example how the explorer is overriding Enter to do something else on macOS).

Metadata

Metadata

Assignees

Labels

debtCode quality issueserror-listProblems view

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions