Skip to content

feat(input): add persistent input history - #5775

Open
UncleBill wants to merge 1 commit into
neoclide:masterfrom
UncleBill:feat/prompt-history
Open

UncleBill wants to merge 1 commit into
neoclide:masterfrom
UncleBill:feat/prompt-history

Conversation

@UncleBill

Copy link
Copy Markdown
Contributor

Plain input dialogs (e.g. workspace.rename, requestInput) now keep a
persistent input history, like Vim's built-in input() history:

  • Inputs confirmed with <cr> are saved to the input_history file
    under the coc data home (~/.config/coc/input_history by default),
    reusing the existing Mru class (same storage as the commands
    history): newest first, deduplicated on recall, capped at 100 entries.
    Cancelled (<esc>) and single-character inputs are not saved.
  • <up> recalls the previous accepted input, <down> moves to the more
    recent one; moving past the newest entry restores the text typed
    before navigation. The cursor is clamped at both ends (no wrap).

Behavior notes:

  • Neovim: in non-list input dialogs <up>/<down> previously moved
    the cursor within the single line; they now navigate the history.
    C-p/C-n are deliberately not bound to avoid conflicting with
    insert-mode completion.
  • QuickPick (list) mode is unchanged: <up>/<down> still navigate
    the filtered list; the history is only recalled in plain input
    dialogs.
  • Vim8 needs no new navigation code: bin/prompt.js already
    forwards <up>/<down> through the existing PromptKeyPress
    channel, previously only consumed by QuickPick. The recalled value is
    rendered through the existing programmatic value update
    (coc#dialog#change_input_value).
  • No public API, typings, or configuration changes.

Tested on both lanes (node scripts/test/cli.mjs): history navigation
and persistence on Neovim, QuickPick list navigation regression, and
Vim8 recall incl. confirming a recalled entry with a placeholder
active.

🤖 Generated with Claude Code

- Inputs confirmed with <cr> are saved to the `input_history` file under
  the coc data home (100 entries, newest first, deduplicated on recall).
- <up>/<down> navigate the history in plain input dialogs and restore
  the text typed before navigation when moving past the newest entry.
- QuickPick (list) mode is unchanged: <up>/<down> still navigate the
  list.
- Vim8 reuses the existing PromptKeyPress channel of the prompt
  terminal; Neovim maps <up>/<down> to PromptKeyPress when the input
  window is not a list.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.79592% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.14%. Comparing base (44e2547) to head (9253d23).

Files with missing lines Patch % Lines
src/model/input.ts 89.79% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5775      +/-   ##
==========================================
- Coverage   98.15%   98.14%   -0.01%     
==========================================
  Files         306      306              
  Lines       53074    53123      +49     
  Branches     9366     9380      +14     
==========================================
+ Hits        52094    52138      +44     
- Misses        847      852       +5     
  Partials      133      133              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant