microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.69k stars 28.69k forks source link

Notebook cell execution hint doesn't show extension-contributed keybinding #122768

Closed roblourens closed 3 years ago

roblourens commented 3 years ago

From https://github.com/microsoft/vscode/issues/122407

We don't actually have a way to look up the keybinding for a command with a certain context. @alexdima I want to add this capability to the keybindings service by letting lookupKeybinding take a CKS like this

lookupKeybinding(commandId: string, target?: IContextKeyService): ResolvedKeybinding | undefined;

is that ok?

roblourens commented 3 years ago

Well, this was an adventure. To properly check the jupyter keybindings and other reasonable keybinding when clauses, we need to consider the notebookViewType key, editor focus keys, and jupyter's config key (because they disable these keybindings with a setting). Long story short, the strategy is to create a fake ContextKeyService that inherits from the editor's, and sets the focus-related context keys. Another strategy would have been just to extract the parts of the when clause that we care about (notebookViewType, config) and evaluate those parts, but I don't want to copy any code related to evaluating when clauses.

If we have more similar cases, we could use a strategy that would involve putting a CKS on cell VMs so we can examine their context independently of the view layer, discussed this with @rebornix.

connor4312 commented 3 years ago

@roblourens are there verification steps for this?

roblourens commented 3 years ago

looks like #122407 regressed

roblourens commented 3 years ago

Verification steps

If you have customized this keybinding, then comment out your custom keybinding

mjbvz commented 3 years ago

@roblourens I believe that still seeing this with b4c1bd0a9b03c749ea011b06c6d2676c8091a70c

Here's with Jupyter disabled:

Screen Shot 2021-06-09 at 9 35 37 AM

And then after enabling Jupyter and restarting VS Code:

Screen Shot 2021-06-09 at 9 36 24 AM
roblourens commented 3 years ago

The tooltip is a separate issue, filed https://github.com/microsoft/vscode/issues/125865