Skip to content

Updates to use CompletionResult - #18671

Merged
fdncred merged 7 commits into
nushell:mainfrom
philocalyst:reedline-signature-update
Jul 20, 2026
Merged

fdncred merged 7 commits into
nushell:mainfrom
philocalyst:reedline-signature-update

Conversation

@philocalyst

@philocalyst philocalyst commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR modernizes and refactors the REPL parser and completion test suite!

  • Sync with Reedline: Aligns Nushell test machinery with updates from Reedline ([reedline#1123](Making Reedline aware of the status of completors reedline#1123)).
  • Signature Consolidation: Consolidates function signatures across tests to eliminate boilerplate, increase readability, and make completion logic more explicit.
  • Helper Cleanup: Removes legacy helper abstractions (such as CompleterExt) to integrate completion patterns directly into Nushell core test utilities.

User-facing changes (Release notes)

n/a

@philocalyst philocalyst changed the title Return CompletionResult from NuCompleter::complete Working with Reedline Jul 19, 2026
@philocalyst philocalyst changed the title Working with Reedline Updates to use CompletionResult Jul 19, 2026
@fdncred
fdncred marked this pull request as draft July 19, 2026 18:49
@fdncred
fdncred marked this pull request as ready for review July 20, 2026 00:30
@philocalyst
philocalyst force-pushed the reedline-signature-update branch 2 times, most recently from 3e08813 to d535096 Compare July 20, 2026 00:48
@philocalyst
philocalyst force-pushed the reedline-signature-update branch from d535096 to 92bfcdc Compare July 20, 2026 00:53
@philocalyst
philocalyst force-pushed the reedline-signature-update branch from 7ee1391 to 5ceb051 Compare July 20, 2026 01:26
@fdncred
fdncred merged commit e98bb37 into nushell:main Jul 20, 2026
15 of 30 checks passed
@github-actions github-actions Bot added this to the v0.115.0 milestone Jul 20, 2026
@fdncred

fdncred commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Thank. Please update the PR to follow the PR template.

@fdncred fdncred added notes:ready Indicates Ready for Release notes notes:other Noted in "Other changes" section labels Jul 20, 2026
fdncred added a commit that referenced this pull request Aug 2, 2026
Requires nushell/reedline#1136
Related PR (Builds ontop of):
#18660

## Description

This is a follow-up to #18334 (non-blocking completions, merged) and
#18671 (test-infra sync, merged). Those landed the async worker model
(`CompletionResult` Fresh/Stale/Pending) but left... several issues
unresolved. Sorry to all the folks who put up with that on the nightlies
:(

Overarching changes:
- Across prompts we're using a LRU cache for storing and managing the
caches. This is configurable, and default bounded to 100. For many
completions nothing is loaded onto the LRU cache, only the intensive
operations (git checkout, carapace stuff, etc.). Open to dramatically
reducing this number, but it *sure* feels nice when it works.
- Cache work is a lot more robust, we do narrowing and carry always an
"env" for the completor environment, so we have a *rough* idea of when
to complete for the sources that are mostly pure.
- Added completionengine for the death of hardcoded dispatch with a
routing enum. This allowed me to rewrite the completor trait around the
context and fetched types, wiring a lot more logic directly through it.
- Added completionsite and sitekind models for a catch-all way for
resolving the facts of what is under the cursor, which kills maybe fifty
sites of span math (what caused the super annoying completion
duplication)
- *commandline complete --type` now type-checks its argument (previously
accepted any string and could silently no-op) and clamps the cursor to a
valid boundary instead of indexing out of range.
- complete paths is shared between file and directory completions, which
eliminates a panic risk and more manual span constructions.
- 
- **Flag/span plumbing.** `FlagRef` and `Flag::long_name` are adopted
across `nu-parser`/`nu-engine`/`nu-cmd-lang` so flag identity survives
through parsing and into completion and help-text rendering, which
eliminated a lot of re-derive logic.

## User-facing changes (Release notes)

- Added `$env.config.completions.cache_size` (default: `100`) to control
that cap.
- Completion results now persist across prompts instead of being
discarded on every new prompt,.
- Fixed a potential panic when narrowing file/directory completions on a
path containing multi-byte (non-ASCII) characters.
- `commandline complete --type` now validates its `--type` argument and
no longer panics on an out-of-range cursor.
- `use`, `overlay use`, `export use`, `source-env`, `hide-env`, `attr
complete`, and `which` now go through the same completion dispatch as
other builtins, fixing inconsistent/missing completions in a few of them

## Additional Notes
- Can't promise that this eliminates all bugs, just most of them. The
bigger thing it gives us is a more robust framework to fix bugs, going
forward. Will be responsive to anything related to completions, and am
okay with a longer review period before merge. The big things are
covered now, however, with the added tests in this PR.
-

fixes #11211

---------

Co-authored-by: Darren Schroeder <[email protected]>
@cptpiepmatz cptpiepmatz added notes:mention Noted in "Hall of Fame" section and removed notes:other Noted in "Other changes" section labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:mention Noted in "Hall of Fame" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants