Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds readline-style interactive editing and history-search features to the Cosmos DB Shell’s RadLine-based prompt, with corresponding docs, localization keys, and unit tests.
Changes:
- Add new RadLine keybinding commands for cursor movement, line/word deletion, history navigation, and Ctrl+D exit/delete.
- Implement reverse/forward incremental history search with syntax-highlighted, underlined match previews and truncation to console width.
- Document keyboard shortcuts and localize history-search prompt labels; add comprehensive hotkey/search unit tests.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/navigation.md | Documents interactive prompt keyboard shortcuts, including incremental history search. |
| CosmosDBShell/lang/en.ftl | Adds localized labels for reverse/forward history search prompt states. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/ReverseSearchHistoryCommand.cs | Implements interactive incremental history search UI/loop at the prompt. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/ReverseHistorySearch.cs | Provides history match finding plus markup formatting/highlighting/underlining and truncation logic. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/ReverseHistorySearchResult.cs | Adds a small result type for search matches and navigation state. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/MoveToStartOfLineCommand.cs | Adds Ctrl+A behavior (move to start). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/MoveToEndOfLineCommand.cs | Adds Ctrl+E behavior (move to end). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/MoveCursorLeftCommand.cs | Adds Ctrl+B behavior (move left). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/MoveCursorRightCommand.cs | Adds Ctrl+F behavior (move right). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/ExitShellCommand.cs | Adds Ctrl+D behavior (exit on empty prompt, else delete char under cursor). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/DeleteToStartOfLineCommand.cs | Adds Ctrl+U behavior (delete to start). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/DeleteToEndOfLineCommand.cs | Adds Ctrl+K behavior (delete to end). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/DeletePreviousWordCommand.cs | Adds Ctrl+W behavior (delete previous word). |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/ClearScreenCommand.cs | Moves command into KeyBindings namespace to align with usage. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.KeyBindings/ClearCurrentLineCommand.cs | Moves command into KeyBindings namespace to align with usage. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Core/ShellInterpreter.cs | Wires new keybindings into the interactive line editor and exposes read-only history for search. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Core/ShellInterpreter.Highlighter.cs | Refactors highlighter to expose markup-building API for reuse in history search preview rendering. |
| CosmosDBShell.Tests/Shell/HotkeyCommandTests.cs | Adds unit tests for new keybinding behaviors and history search formatting/highlighting/truncation. |
ShellInterpreter.Highlighter: BuildHighlightedMarkup now sets oldHighlightedText alongside oldHighlightStatement on the successful-parse path so the StartsWith reuse branch is actually reachable. ClearHighlightStatement also resets oldHighlightedText so the cached previous-statement reuse cannot outlive its text. ReverseHistorySearch: FormatSearchPromptMarkup now also truncates the rendered query in the prefix when needed via TruncateQueryForPrompt, keeping the entire prompt within maxWidth even for long pasted queries. Prevents the prompt from wrapping and ReverseSearchHistoryCommand.ClearLine leaving artifacts. Added regression test ReverseSearch_FormatSearchPromptMarkup_TruncatesLongQueryToFitMaxWidth.
sevoku
approved these changes
May 4, 2026
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.
Summary:
Validation:
HotkeyCommandTests|FullyQualifiedNameHighlighterTests|FullyQualifiedName~LocalizationKeyAuditTests" -nologo -p:BaseOutputPath=c:\work\CosmosDBShell\obj\agent-hotkey-test\Related: AzureCosmosDB/cosmosdb-shell-preview#22