Slash-command menu

Floating menu that lists the top-scoring slash commands when the input starts with `/` or `:`. Up/Down moves the highlight, Tab completes, Ctrl+Enter runs, Esc clears.

Category: repl-features

Description

## Overview The slash menu is the discoverability surface for the shell's built-in verbs. It activates whenever the input buffer is a single line whose first non-whitespace character is `/` or `:` and renders as a bordered overlay directly above the input island. The candidate pool is `COMMAND_CATALOG`, a static list of user-facing slash commands covering session control, offline SQL analysis, embedded docs, catalog queries, and compute-node management. ## Behavior - Activation (`slash_menu::is_active`): buffer contains no newlines and, after trimming leading whitespace, starts with `/` or `:`. Multi-line buffers are never treated as slash input. - Scoring (`score_match`): exact match scores 1000, prefix scores 900 minus the suffix length, substring scores 500 minus the position, subsequence scores up to 200 with a penalty for spread. Non-matching candidates are filtered out entirely. The top 8 are displayed, sorted by score descending then alphabetically. - Query extraction: the user's typed verb is the first whitespace-separated token after the leading sigil. Arguments after the verb are preserved verbatim on Tab-complete and do not influence the ranking. - Tab-complete (`tab_complete_to`): replaces the typed verb with the selected entry's canonical name and keeps whatever arguments were already typed. If the typed verb already matches the selected entry, Tab is a no-op. - Dismissal: any non-slash edit removes the leading sigil and the menu disappears. Esc is not a special case; clearing the buffer (Ctrl+C) has the same effect. ## Interaction - Up/Down navigation is live in the current build: the event loop intercepts both keys while the menu is active and wraps the selection within the visible slice. (An older comment in `slash_menu.rs` suggested this was deferred; the keymap in `shell/mod.rs` implements it.) - Typing or Backspace resets the selection to the top match so the first result stays predictable after the user narrows the filter. - Ctrl+Enter force-submits the buffer as-is, regardless of which entry is highlighted. The menu does not run the highlighted entry directly; Tab-then-Enter is the two-step sequence. - Colon prefix (`:`) is a complete alias for slash (`/`). Both route through the same matcher and the same runner dispatch. ## Compatibility - The menu exists only in the interactive shell. `--classic` has slash commands but no floating menu: completion there is through reedline's tab-completer against the built-in keyword list, and the catalogue is discoverable only via `/help`.

Examples

# Type `/lin` to narrow the menu to /lineage, /lineage-sql
/lin
# Colon prefix is an exact alias of slash
:help

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →