fix(keymap): Restart Server is bindable, like every other menu item

Forty-five items in the app menu dispatch an action. Forty-four of them
can be given a key; `RestartDaemon` could not, because it was missing
from `default_bindings` and `make_binding` — so config.json dropped the
name silently and the Keybindings page never listed it.

Nothing else was missing. The gpui action is declared, the handler is
wired, the app menu dispatches it and the palette runs it. Only the two
table entries that make a name bindable were absent.

This corrects a claim I made when I moved it out of the palette's chord
lookup: I said then that making it bindable "means a gpui action and a
handler, which is a feature rather than a fix". That was wrong — both
already existed, and the app menu had been dispatching the action the
whole time. Finding it took comparing the menu against the keymap rather
than reading either alone.

No default chord, like the sixty-odd others that ship unbound. The
palette gets its chord lookup back, so once a key is on it the row shows
it — which is the thing that lookup was doing wrong before and is now
simply right.

The shortcuts-page guard added earlier this session caught the last step
without being asked: it failed on `RestartDaemon` the moment the action
became bindable, which is what it is for.
This commit is contained in:
l0ng-ai
2026-08-23 01:19:51 +08:00
parent 2d5621a71c
commit 36404a6cbb
3 changed files with 12 additions and 8 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ Keybindings**:
| Panels | `ShowRightPanelInfo` · `ShowRightPanelChanges` · `ShowRightPanelFiles` |
| Document | `ToggleDocumentFill` · `DocumentWidthThird` · `DocumentWidthHalf` · `DocumentWidthTwoThirds` |
| SSH | `ToggleSftp` · `ShowSshForwards` · `OpenSshProfiles` |
| Application | `About` · `CheckForUpdates` · `OpenDocumentation` · `OpenDiscord` · `ReportIssue` · `ShowAll` · `ZoomWindow` |
| Application | `About` · `CheckForUpdates` · `OpenDocumentation` · `OpenDiscord` · `ReportIssue` · `ShowAll` · `ZoomWindow` · `RestartDaemon` |
## Rebinding syntax
+10
View File
@@ -465,6 +465,11 @@ pub(crate) fn default_bindings() -> Vec<(&'static str, &'static str)> {
// Deliberately unbound. Docking is the default and Esc already gets the
// terminal back, so a default chord here would only be one more thing
// competing for a two-key combination nobody asked for.
// Bindable with no default chord, like the rest of this run. It is
// reachable from the app menu and the palette; leaving it out of
// this table was the one thing that made it the only menu item of
// forty-five a user could not put a key on.
("RestartDaemon", ""),
("ToggleDocumentFill", ""),
("DocumentWidthThird", ""),
("DocumentWidthHalf", ""),
@@ -654,6 +659,10 @@ fn authored_entry(action: &str) -> Option<(CommandGroup, String)> {
t(L10nKey::AppMenuRightPanel).to_string(),
),
"ToggleCodePanel" => (CommandGroup::View, t(L10nKey::AppMenuCodePanel).to_string()),
"RestartDaemon" => (
CommandGroup::Application,
t(L10nKey::CmdRestartServer).to_string(),
),
"ToggleDocumentFill" => (
CommandGroup::View,
t(L10nKey::CmdToggleDocumentFill).to_string(),
@@ -1228,6 +1237,7 @@ fn make_binding(action: &str, keystroke: &str) -> Option<KeyBinding> {
"ToggleSftp" => KeyBinding::new(keystroke, ToggleSftp, None),
"ShowSshForwards" => KeyBinding::new(keystroke, ShowSshForwards, None),
"ToggleCodePanel" => KeyBinding::new(keystroke, ToggleCodePanel, None),
"RestartDaemon" => KeyBinding::new(keystroke, RestartDaemon, None),
"ToggleDocumentFill" => KeyBinding::new(keystroke, ToggleDocumentFill, None),
"DocumentWidthThird" => KeyBinding::new(keystroke, DocumentWidthThird, None),
"DocumentWidthHalf" => KeyBinding::new(keystroke, DocumentWidthHalf, None),
+1 -7
View File
@@ -302,6 +302,7 @@ impl CommandKind {
ScmCommitAmend => "ScmCommitAmend",
ScmRefresh => "ScmRefresh",
ScmToggleGraph => "ScmToggleGraph",
RestartDaemon => "RestartDaemon",
ScmPull => "ScmPull",
ScmFetch => "ScmFetch",
ScmSync => "ScmSync",
@@ -309,12 +310,6 @@ impl CommandKind {
OpenBranchPicker => "ScmCheckoutBranch",
ToggleDiffViewMode => "ToggleDiffViewMode",
// No keymap action of their own, so there is no shortcut to show.
// `RestartDaemon` is here rather than above because it named
// `"RestartDaemon"`, which the keymap has never bound: the lookup
// could only ever come back empty, and naming an action that does
// not exist reads like one that does. Restarting the server is
// palette-only for now; giving it a bindable action means a gpui
// action and a handler, which is a feature rather than a fix.
CopyText
| CutText
| PasteText
@@ -325,7 +320,6 @@ impl CommandKind {
| OpenThemePicker
| OpenSshConnectInput
| OpenSshConnect(_)
| RestartDaemon
| SetTheme(_)
| ActivateTab(_)
| ConnectSavedProfile(_)