From d4ec78f328216ec2417f947c4442e42a5bd4a41f Mon Sep 17 00:00:00 2001
From: Adam <71665039+Adam-Alani@users.noreply.github.com>
Date: Sat, 9 Mar 2024 05:01:28 +0100
Subject: [PATCH] Add strikethrough to deprecated methods in CompletionsMenu
(#9086)
Release Notes:
- Added ([#8390](https://github.com/zed-industries/zed/issues/8390)).
- Also Grays out deprecated methods
Before
After
---
crates/editor/src/editor.rs | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 7518851212..a003b948d8 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -60,9 +60,9 @@ use gpui::{
AnyElement, AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Context,
DispatchPhase, ElementId, EventEmitter, FocusHandle, FocusableView, FontId, FontStyle,
FontWeight, HighlightStyle, Hsla, InteractiveText, KeyContext, Model, MouseButton,
- ParentElement, Pixels, Render, SharedString, Styled, StyledText, Subscription, Task, TextStyle,
- UnderlineStyle, UniformListScrollHandle, View, ViewContext, ViewInputHandler, VisualContext,
- WeakView, WhiteSpace, WindowContext,
+ ParentElement, Pixels, Render, SharedString, StrikethroughStyle, Styled, StyledText,
+ Subscription, Task, TextStyle, UnderlineStyle, UniformListScrollHandle, View, ViewContext,
+ ViewInputHandler, VisualContext, WeakView, WhiteSpace, WindowContext,
};
use highlight_matching_bracket::refresh_matching_bracket_highlights;
use hover_popover::{hide_hover, HoverState};
@@ -930,6 +930,15 @@ impl CompletionsMenu {
// Ignore font weight for syntax highlighting, as we'll use it
// for fuzzy matches.
highlight.font_weight = None;
+
+ if completion.lsp_completion.deprecated.unwrap_or(false) {
+ highlight.strikethrough = Some(StrikethroughStyle {
+ thickness: 1.0.into(),
+ ..Default::default()
+ });
+ highlight.color = Some(cx.theme().colors().text_muted);
+ }
+
(range, highlight)
},
),