Skip to content

fix(completion): complete active overlay names for overlay hide - #19543

Merged
fdncred merged 2 commits into
nushell:mainfrom
manavkdubey:fix/overlay-hide-completion
Nov 15, 2026
Merged

fdncred merged 2 commits into
nushell:mainfrom
manavkdubey:fix/overlay-hide-completion

Conversation

@manavkdubey

@manavkdubey manavkdubey commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #11570

Add overlay-name completion for overlay hide using the existing built-in completion framework.

Suggestions include overlays active in both the runtime stack and the permanent parser state, excluding the default zero overlay. Using the permanent parser state keeps the current target available even when the temporary completion parse has already hidden it.

Completion matches decoded names and quotes them when needed for insertion. Suggestions remain available while typing unfinished double-quoted escapes. Results are not cached across prompts, so activating or hiding an overlay is reflected in subsequent completions.

overlay new spam
"overlay hide sp" | commandline complete
# => [spam]

User-facing changes (Release notes)

overlay hide now completes active overlay names, including names that require quoting.

Additional notes

  • Regression coverage includes empty and partial input, hidden overlays, parser/runtime disagreements, quoting, incomplete escapes, replacement spans, Unicode, flags, and overlay changes across prompts.
  • Escape-sensitive tests apply and execute the completed command.
  • On macOS arm64, all 428 CLI unit tests and 394 CLI integration tests passed, with two existing integration tests ignored.
  • Both Clippy checks, formatting, typos, and whitespace checks passed.
  • Built the executable and verified completion through commandline complete. Windows/Linux execution, the full workspace suite, and manual Tab-menu verification of this revision remain unverified.
  • Tracking earlier unexecuted commands in the buffer and fixing the underlying parser/runtime discrepancy from Fix stale $env in the parser and completer after overlay use inside a block #19458 remain outside this change.

@fdncred fdncred left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review overview

🟡 Changes recommended

On the branch, Tab after overlay hide offers the active overlays. The menu narrows as you type, names like "with space" and say"hi complete and then hide, and zero and hidden overlays stay out. The medium is about an overlay activated inside a block, which gets offered but can't be hidden.

Findings: 0 High severity · 1 Medium severity · 2 Low severity

Open (3)

Notes from my clanker, checked on aff5d36. Built the branch, ran cargo test -p nu-cli --test tests -- overlay_hide (27 passed) and the overlay_hide unit test (1 passed), and compared the branch with 0.117.1 (7bff3d1) through commandline complete and with real Tab presses in a pty-driven REPL, including the two-overlay menu. The first thread's change was built and tested as a trial, then reverted. Clippy, fmt and the full test suite are CI's, green on this head.

Comment on lines +25 to +27
if prefix.len() == 1 || prefix.last() != Some(&quote) || escaped {
prefix.push(quote);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low severity An unfinished escape returns no suggestions

With an overlay named say"hi, Tab finds it at every point while typing "say\" except right after the backslash:

'overlay hide "say' | commandline complete     # ["\"say\\\"hi\""]
'overlay hide "say\' | commandline complete    # []
'overlay hide "say\"' | commandline complete   # ["\"say\\\"hi\""]

The " pushed after say\ turns into an escaped quote, so unescape_unquote_string errors, and the empty answer also blocks any fallback. Popping an unpaired trailing backslash before pushing the closing quote keeps the match. From reading the code, a partial \u{ ends up the same way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed trailing-backslash and incomplete Unicode/hex escape completion. The trailing backslash was also being parsed as a separate garbage argument, so I added a narrow completion-site recovery for that case. Added regression coverage for replacement spans, escaped backslashes, and completed versus incomplete escapes.

@manavkdubey

Copy link
Copy Markdown
Contributor Author

Updated the branch to address all three comments. The CLI suite, both Clippy checks, formatting, and spelling checks pass. Ready for another look.

@manavkdubey
manavkdubey requested a review from fdncred November 15, 2026 04:07
@fdncred fdncred added notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Nov 15, 2026
@fdncred
fdncred merged commit 515b6e5 into nushell:main Nov 15, 2026
24 of 27 checks passed
@fdncred

fdncred commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Thanks!

@github-actions github-actions Bot added this to the v0.118.0 milestone Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add autocomplete to overlay hide

2 participants