mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
zzz
This commit is contained in:
parent
8ccc7b81c8
commit
e568184dda
2 changed files with 13 additions and 3 deletions
|
@ -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>| {
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
@ -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<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>>,
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue