Feat/keybind teacher - #285713
Open
JohnABardo wants to merge 9 commits into
Open
Conversation
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a Keybinding Teacher feature that helps users discover keyboard shortcuts by showing notifications when they repeatedly use mouse/menu actions for commands that have keybindings. The feature is experimental and disabled by default.
Key changes:
- Extends
IKeybindingServicewithcurrentlyDispatchingCommandIdto distinguish keyboard vs UI command execution - Implements tracking service with configurable threshold and cooldown
- Adds management commands for dismissed suggestions and data clearing
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/platform/keybinding/common/keybinding.ts |
Adds currentlyDispatchingCommandId property to IKeybindingService interface |
src/vs/platform/keybinding/common/abstractKeybindingService.ts |
Implements public getter for currentlyDispatchingCommandId |
src/vs/platform/keybinding/test/common/mockKeybindingService.ts |
Updates mock service with new property |
src/vs/workbench/contrib/keybindingTeacher/common/keybindingTeacher.ts |
Defines service interface and types |
src/vs/workbench/contrib/keybindingTeacher/common/keybindingTeacherConfiguration.ts |
Registers configuration settings |
src/vs/workbench/contrib/keybindingTeacher/common/keybindingTeacherStorage.ts |
Implements persistence layer using storage service |
src/vs/workbench/contrib/keybindingTeacher/browser/keybindingTeacherService.ts |
Main service implementation with command execution tracking |
src/vs/workbench/contrib/keybindingTeacher/browser/keybindingTeacher.contribution.ts |
Service and command registration |
src/vs/workbench/workbench.common.main.ts |
Imports keybinding teacher contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keybinding Teacher Feature - PR Description
Description
This PR implements a Keybinding Teacher feature that helps users discover and learn keyboard shortcuts by showing notifications when they repeatedly use mouse/menu actions for commands that have keybindings.
Fixes #26729 (429 👍)
Related to #78091
As mentioned in #78091, the VS Code team expressed openness to accepting this as a core contribution.
What This Feature Does
The Keybinding Teacher monitors command execution and shows educational notifications when:
Example Notification
Key Features
currentlyDispatchingCommandIdto reliably distinguish keyboard shortcuts from UI actionsKeybinding Teacher: Manage Dismissed Suggestions- View and re-enable dismissed commandsKeybinding Teacher: Clear All Data- Reset all statistics and dismissed commandsConfiguration Settings
All settings are under
workbench.keybindingTeacher.*:enabled(default:false): Enable the keybinding teacherthreshold(default:3): Show suggestion every N UI executionscooldownMinutes(default:60): Minimum time between suggestions for the same command (0 = no cooldown)Implementation Details
Core Changes
Platform Layer (
src/vs/platform/keybinding/):IKeybindingServiceinterface withcurrentlyDispatchingCommandIdpropertyAbstractKeybindingServiceto expose command dispatch stateMockKeybindingServicefor test compatibilityWorkbench Contribution (
src/vs/workbench/contrib/keybindingTeacher/):IKeybindingTeacherService- Service interfaceKeybindingTeacherService- Main implementation with command execution trackingKeybindingTeacherStorage- Persistence layer usingIStorageServicekeybindingTeacherConfiguration.ts- Settings registrationkeybindingTeacher.contribution.ts- Service and command registrationDesign Decisions
StorageScope.APPLICATIONfor cross-workspace persistenceonDidExecuteCommandand checks ifcurrentlyDispatchingCommandIdmatches to determine execution sourceManual Testing Steps
Enable and configure the feature:
Ctrl+,/Cmd+,)Workbench › Keybinding Teacher: EnabledThresholdto your desired value (e.g.,3)Cooldown Minutesas needed (e.g.,0for testing)Test basic notification:
Ctrl+Shift+Pfor 'show all commands'"Test dismiss functionality:
Test Clear All Data:
F1)Keybinding Teacher: Clear All DataTest Manage Dismissed Suggestions:
F1)Keybinding Teacher: Manage Dismissed Suggestionsworkbench.action.showCommandsfrom the listTest keyboard shortcuts are NOT tracked:
Ctrl+Shift+P/Cmd+Shift+Pdirectly 10+ timesExpected Behavior
Notes