assistant2: Rework @mentions
(#26983)
https://github.com/user-attachments/assets/167f753f-2775-4d31-bfef-55565e61e4bc Release Notes: - N/A
This commit is contained in:
parent
4a5f89aded
commit
699369995b
18 changed files with 1637 additions and 485 deletions
|
@ -1,6 +1,6 @@
|
|||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
div, px, uniform_list, AnyElement, BackgroundExecutor, Div, Entity, Focusable, FontWeight,
|
||||
div, px, uniform_list, AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight,
|
||||
ListSizingBehavior, ScrollStrategy, SharedString, Size, StrikethroughStyle, StyledText,
|
||||
UniformListScrollHandle,
|
||||
};
|
||||
|
@ -236,6 +236,7 @@ impl CompletionsMenu {
|
|||
runs: Default::default(),
|
||||
filter_range: Default::default(),
|
||||
},
|
||||
icon_path: None,
|
||||
documentation: None,
|
||||
confirm: None,
|
||||
source: CompletionSource::Custom,
|
||||
|
@ -539,9 +540,17 @@ impl CompletionsMenu {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
let color_swatch = completion
|
||||
|
||||
let start_slot = completion
|
||||
.color()
|
||||
.map(|color| div().size_4().bg(color).rounded_xs());
|
||||
.map(|color| div().size_4().bg(color).rounded_xs().into_any_element())
|
||||
.or_else(|| {
|
||||
completion.icon_path.as_ref().map(|path| {
|
||||
Icon::from_path(path)
|
||||
.size(IconSize::Small)
|
||||
.into_any_element()
|
||||
})
|
||||
});
|
||||
|
||||
div().min_w(px(280.)).max_w(px(540.)).child(
|
||||
ListItem::new(mat.candidate_id)
|
||||
|
@ -559,7 +568,7 @@ impl CompletionsMenu {
|
|||
task.detach_and_log_err(cx)
|
||||
}
|
||||
}))
|
||||
.start_slot::<Div>(color_swatch)
|
||||
.start_slot::<AnyElement>(start_slot)
|
||||
.child(h_flex().overflow_hidden().child(completion_label))
|
||||
.end_slot::<Label>(documentation_label),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue