Fix anchor biases for completion replacement ranges (esp slash commands) (#32262)

Closes #32205

The issue was that in some places the end of the replacement range used
anchors with `Bias::Left` instead of `Bias::Right`. Before #31872
completions were recomputed on every change and so the anchor bias
didn't matter. After that change, the end anchor didn't move as the
user's typing. Changing it to `Bias::Right` to "stick" to the character
to the right of the cursor fixes this.

Release Notes:

- Fixes incorrect auto-completion of `/files` in text threads (Preview
Only)
This commit is contained in:
Michael Sloan 2025-06-06 14:54:00 -06:00 committed by GitHub
parent 51585e770d
commit e0057ccd0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 12 deletions

View file

@ -765,7 +765,7 @@ impl CompletionProvider for ContextPickerCompletionProvider {
let snapshot = buffer.read(cx).snapshot();
let source_range = snapshot.anchor_before(state.source_range.start)
..snapshot.anchor_before(state.source_range.end);
..snapshot.anchor_after(state.source_range.end);
let thread_store = self.thread_store.clone();
let text_thread_store = self.text_thread_store.clone();