Key binding on view item command doesn't provide the view item
See original GitHub issueIssue Type: Bug
This is easily reproducible using the tree-view-sample
repo.
- Add a key binding for
nodeDependencies.editEntry
- Open the package explorer view and click on one of the nodes
- 🐛 execute the key binding and notice the command fails (while if you click the pencil icon it will work fine)
When the command gets executed from the key binding it isn’t getting the proper context. This breaks most key bindings for commands on view items.
/cc @jrieken
VS Code version: Code 1.33.1 (51b0b28134d51361cf996d2f0a1c698247aeabd8, 2019-04-11T08:27:14.102Z) OS version: Windows_NT x64 10.0.18362
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-6700K CPU @ 4.00GHz (8 x 4008) |
GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: enabled surface_synchronization: enabled_on video_decode: enabled webgl: enabled webgl2: enabled |
Memory (System) | 31.93GB (15.81GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:11 (9 by maintainers)
Top Results From Across the Web
C#/WPF: KeyBinding not triggering Command - Stack Overflow
In 3.5 its "feature". UserControl.InputBindings is not part of dataContext tree so you cannot bind to items of class, that is bound to...
Read more >when clause contexts | Visual Studio Code Extension API
For example, VS Code uses when clauses to enable or disable command keybindings, which you can see in the Default Keybindings JSON (Preferences:...
Read more >Mac keyboard shortcuts - Apple Support
Command -1: View the items in the Finder window as icons. Command-2: View the items in a Finder window as a list.
Read more >Keybinds - Rust Wiki
This keybind will flip the view model of the item you're holding in your hand ... Creating a bind combining these commands will...
Read more >Layouts and binding expressions | Android Developers
This view element is what your root would be in a non-binding layout file. The following code shows a sample layout file: <?xml...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. We could potentially have a sort of
IContextKeysProvider
feature at theWorkbench(List|Tree)
level which would do this for you. Something like:Or so.
What the the expected context? That somehow
viewItem
is the selected/focused tree item? If so, the custom tree view needs to create a scoped context key service in which it sets theviewItem
context as the tree selection/focus changes. That way, the context will be set when the user invokes the keybinding and has DOM focus inside the custom tree view DOM element.