Skip to content

Commit

Permalink
zzz
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneToIgnore committed Dec 22, 2024
1 parent 8ccc7b8 commit 385e05e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ pub fn init(cx: &mut AppContext) {
workspace::register_project_item::<Editor>(cx);
workspace::FollowableViewRegistry::register::<Editor>(cx);
workspace::register_serializable_item::<Editor>(cx);
inlay_hint_cache::init(cx);

cx.observe_new_views(
|workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {
Expand Down
15 changes: 12 additions & 3 deletions crates/editor/src/inlay_hint_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::{
use anyhow::Context;
use clock::Global;
use futures::future;
use gpui::{AsyncWindowContext, Model, ModelContext, Task, ViewContext};
use language::{language_settings::InlayHintKind, Buffer, BufferSnapshot};
use gpui::{AppContext, AsyncWindowContext, Model, ModelContext, Task, ViewContext};
use language::{language_settings::InlayHintKind, Buffer, BufferSnapshot, LanguageName};
use parking_lot::RwLock;
use project::{InlayHint, ResolveState};

Expand All @@ -31,6 +31,15 @@ use sum_tree::Bias;
use text::{BufferId, ToOffset, ToPoint};
use util::{post_inc, ResultExt};

#[derive(Default, Clone)]
pub struct InlayHintToggle(HashMap<Option<LanguageName>, bool>);

impl gpui::Global for InlayHintToggle {}

pub fn init(cx: &mut AppContext) {
cx.set_global(InlayHintToggle::default());
}

pub struct InlayHintCache {
hints: HashMap<ExcerptId, Arc<RwLock<CachedExcerptHints>>>,
allowed_hint_kinds: HashSet<Option<InlayHintKind>>,
Expand Down Expand Up @@ -291,7 +300,7 @@ impl InlayHintCache {
self.invalidate_debounce = debounce_value(new_hint_settings.edit_debounce_ms);
self.append_debounce = debounce_value(new_hint_settings.scroll_debounce_ms);
let new_allowed_hint_kinds = new_hint_settings.enabled_inlay_hint_kinds();
match (self.enabled, new_hint_settings.enabled) {
match dbg!(self.enabled, new_hint_settings.enabled) {
(false, false) => {
self.allowed_hint_kinds = new_allowed_hint_kinds;
ControlFlow::Break(None)
Expand Down

0 comments on commit 385e05e

Please sign in to comment.