editor: Utilize filter_text
from language server for filter_range
(#33155)
Closes #33106 Instead of directly using `filter_text` in `StringMatchCandidate`, which yields better results for fuzzy matching but messes up with highlighting letters in bold, as `positions` list generated by fuzzy crate are now of `filter_text` and not `label` shown to the user. This PR fixes it by keeping use of `filter_range` in `StringMatchCandidate`, which is range w.r.t to `label` shown to user. And actually generating this `filter_range` at source by using `filter_range` if exists. - [x] Tests Release Notes: - Fixed issue where incorrect letters are marked as bold in completions.
This commit is contained in:
parent
834cdc1271
commit
76e3136369
10 changed files with 206 additions and 61 deletions
|
@ -5306,16 +5306,6 @@ impl ProjectItem for Buffer {
|
|||
}
|
||||
|
||||
impl Completion {
|
||||
pub fn filter_text(&self) -> &str {
|
||||
match &self.source {
|
||||
CompletionSource::Lsp { lsp_completion, .. } => lsp_completion
|
||||
.filter_text
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| self.label.filter_text()),
|
||||
_ => self.label.filter_text(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> Option<CompletionItemKind> {
|
||||
self.source
|
||||
// `lsp::CompletionListItemDefaults` has no `kind` field
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue