Skip to main content

Module command

Module command 

Source
Expand description

What an app can do, declared once: each CommandSpec has an id, a title, an icon, a line saying what it does, a group, a key, the JSON Schema of its arguments, when it is enabled (and why not), and the function that runs it. The Registry turns that one list into the menus (Registry::menu_button), the search rows (crate::search), the key bindings (Registry::bind_keys) and an agent’s tools (kitchen-agent), so none drifts from the others: a command is in the search because it is in the list, greyed with its reason wherever it cannot run.

Structs§

CommandSpec
One thing an app can do.
MenuSpec
A menu of a menu row or title bar: its title and its entries.
Registry
Every command of an app, shared by its menus, search, keys and agent (a cheap handle: clones share the same list).
RunCommand
The action every command key and menu item dispatches: run the command id (no arguments).

Enums§

MenuItem
An entry of a menu.

Functions§

key_label
A key in GPUI’s notation as people read it: secondary-shift-s is “Ctrl+Shift+S” (and “⌘⇧S” on macOS), f3 is “F3”.

Type Aliases§

CheckedFn
Whether a toggle command is on (a check mark in menus).
EnabledFn
Whether a command can run now; Err says why not (shown greyed in menus and search).
MenuProvider
Makes a menu’s entries when it opens, from what the app holds then (its images, recent files, the models that fit): see Registry::provide and MenuItem::Provided.
RunFn
Runs a command with its arguments (null when it takes none); its result is JSON (null for a plain action), and an error says why it did not run.