Repository navigation
fix(completion): complete active overlay names for overlay hide - #19543
Conversation
There was a problem hiding this comment.
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
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.
| if prefix.len() == 1 || prefix.last() != Some("e) || escaped { | ||
| prefix.push(quote); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Updated the branch to address all three comments. The CLI suite, both Clippy checks, formatting, and spelling checks pass. Ready for another look. |
|
Thanks! |



Description
Fixes #11570
Add overlay-name completion for
overlay hideusing the existing built-in completion framework.Suggestions include overlays active in both the runtime stack and the permanent parser state, excluding the default
zerooverlay. 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.
User-facing changes (Release notes)
overlay hidenow completes active overlay names, including names that require quoting.Additional notes
typos, and whitespace checks passed.commandline complete. Windows/Linux execution, the full workspace suite, and manual Tab-menu verification of this revision remain unverified.$envin the parser and completer afteroverlay useinside a block #19458 remain outside this change.