fix: unable to detect Color completion item hex code for some LSPs (#12501)
Co-authored-by: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com>
This commit is contained in:
parent
0f2ce303c5
commit
e01775a667
1 changed files with 4 additions and 1 deletions
|
@ -92,8 +92,11 @@ impl menu::Item for CompletionItem {
|
|||
value, ..
|
||||
}) => value,
|
||||
};
|
||||
Color::from_hex(text)
|
||||
// Language servers which send Color completion items tend to include a 6
|
||||
// digit hex code at the end for the color. The extra 1 digit is for the '#'
|
||||
text.get(text.len().checked_sub(7)?..)
|
||||
})
|
||||
.and_then(Color::from_hex)
|
||||
.map_or("color".into(), |color| {
|
||||
Spans::from(vec![
|
||||
Span::raw("color "),
|
||||
|
|
Loading…
Reference in a new issue