add a SlashCommand enum with /help, and highlight commands in the prompt - #3
Merged
Merged
Conversation
Revantark
requested changes
Aug 21, 2026
editor_text joined the whole buffer to inspect its first line, so a large paste made every keystroke O(buffer). Only line 0 can be a command, and it is O(1) to reach. Also bumps strum to 0.28 and drops two tautological tests: help is generated by iterating the variants, so asserting it contains them tests nothing, and name/parse are both derived from the same strum attribute.
Rust 1.98 added the drain_collect lint, which fails the workspace under -D warnings. Draining into a new Vec to join it allocates twice.
# Conflicts: # crates/alan/src/core/controller.rs # crates/alan/src/core/mod.rs # crates/alan/src/views/mod.rs
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.
/loginwas a string comparison, so a typo in the literal compiled fine and failed at runtime. Commands are now aSlashCommandenum: adding one fails to compile until it is both handled and described./helpis generated from the variants, so it cannot drift from what actually parses./plancame along free — it toggles the same state as Shift+Tab, which nothing in the UI mentioned.A recognised command is coloured in the prompt, so you can see it will run before pressing Enter. The highlight asks the same
parsethe controller dispatches on, rather than re-deriving the rule, so it cannot colour something that would not run./helpoutput goes to a newEntry::Inforather thanEntry::Response. Streamed text merges into a trailingResponse, so running/helpwhile the agent was replying appended the model's text onto the help output.Infois never merged into, so the fix is structural rather than a guard.A command is now the whole input: one line, starting with
/. Previously" /plan"ran with no highlight to match, and"/plan\nmore text"ran the command and discarded the rest without saying so.Unrelated one-liner:
crates/agent/src/agent.rswas failingcargo fmton main, which reddens CI for every open PR.Verified with
cargo fmt,cargo clippy --workspace --all-targets -- -D warnings, andcargo test --workspace(74 passing). Both behaviour changes above have regression tests.