Repository navigation
feat(completions): add a background-completions opt-out - #18764
Conversation
|
@blindFS Can you check out if opting out fixes your problem? |
Yes it does fix my problem, thanks! I really appreciate your help, from joining the discussion with a more contemporary solution to this PR. |
|
BTW, I think |
What lets you think that? |
Nice, happy to help! After we stabilized completions, we can then introduce this option or maybe include more codepaths if we experience more Problems with old configs. Fine with that? |
LSP server runs in a dedicated process As for the command of |
|
Shouldn't new experimental options start out as opt-in first? And then later converted to opt-out? |
|
Depends on how the completion progresses until release i would suggest. |
Do you have a reason to have this feature non-blocking? I think I agree, only completions will get changed. |
I don't follow, I mean I was suggesting to make more cases blocking.
Yep, blocking for fzf feels appropriate, as well as blocking for |
|
All good then we are on the same page. I was jut making sure. |
Oh, I thought all completion queries are handled in background before this. |
|
Is this PR intended for v0.115.0 release? |
|
Well if we merge it, i would first make sure that it really makes the async completions code path impossible. And i would keep it opt-out not opt in. But it depends on how important it still is for @blindFS |
I would like to see it merged, but still I'm not sure whether it runs in the background for |
|
Thats what i will check out before we merge it. |
ac86a07 to
e1cdee6
Compare
While the worker computes, reedline keeps reading the terminal, so a custom completer that drives an interactive picker (`$candidates | fzf`) paints its UI but never receives a keystroke. Disabling the option makes the REPL completer settle on the reedline thread: reedline blocks on input as it did before nushell#18334, and the completer can hand the terminal to its child. `complete()` is the only path to the worker spawn, so gating it turns off every background piece at once. The cache is bypassed too: an interactive completer is not a pure function, and the pre-nushell#18334 behavior this restores had no completion cache either. The LSP and `commandline complete` already run inline through `CompletionEngine` and are untouched.
e1cdee6 to
d16f93f
Compare
|
Should be fine to land from my side, the op-out will not spawn any background threads, but obviously the completion backend stays the same. |
| cache, | ||
| cache_env, | ||
| worker: None, | ||
| background: true, |
There was a problem hiding this comment.
I think this makes completion queries of nu-lsp and commandline complete handled in background?
There was a problem hiding this comment.
Neither of those go through NuCompleter at all, right?
nu-lsp builds a CompletionEngine in completion.rs and calls fetch_completions_at on it, same for commandline complete in commands/commandline/complete.rs.
The worker only ever gets spawned from ReedlineCompleter::complete, thus the background flag does never influence either of them.
There was a problem hiding this comment.
I see, I didn't go through the source code in depth. Purely judging by the name, I thought for_repl covers all the reedline related stuff and with_cache is for the rest.
Now I wonder who else would call this with_cache function?
There was a problem hiding this comment.
@kronberger-droid any idea why we still need this with_cache?
|
Sad story, a new release is already launched... |
|
Yeah sorry, piet was already finished with all the preparations when we were still discussing, and I did not want to stall the release on it. I had not to much time this weekend to push it through before, my bad. |
|
But I am open helping you with finding an alternative config for the stuff you need. |
I'm not aware of the release schedule, otherwise I wouldn't hinder the merge. Now, as it's released already, let's wait and see whether we still need this or not. |
This PR is still in the air, but I'm still confused on the reasoning here, keeping it opt-out erodes the formalization of completion behaviors that we worked on and merged? I thought this was purely a bridge for users migrating their own configurations. |
|
You opt-out of the background completion path. So its just an escape hatch. |
Description
While the completion worker computes, reedline keeps reading the terminal, so a custom completer that drives an interactive picker (
$candidates | fzf) paints its UI but never receives a keystroke.This adds a
background-completionsexperimental option (Status::OptOut, so the async path stays the default).Disabled, the REPL completer settles on the reedline thread: reedline blocks on input as it did before #18334, and the completer can hand the terminal to its child.
Scope of the opt-out:
complete()is the only path to the worker spawn, so gating it turns off every background piece at once;poll_completionstaysIdle.fetch_completions_at): the opt-out restores the old interaction model, not old results.commandline completealready run inline throughCompletionEngineand are untouched.This option exists for configs that need the old blocking semantics back.
User-facing changes (Release notes)
Add
background-completionsopt-outAdded the
background-completionsexperimental option (enabled by default). Disabling it makes completions block the line editor again, which lets custom completers drive interactive child processes like fzf:Additional notes
fixes #18771