diff --git a/helix-term/src/handlers/workspace_trust.rs b/helix-term/src/handlers/workspace_trust.rs index b0bcdc59..31d3d364 100644 --- a/helix-term/src/handlers/workspace_trust.rs +++ b/helix-term/src/handlers/workspace_trust.rs @@ -24,11 +24,7 @@ pub(super) fn register_hooks(_handlers: &Handlers) { let (workspace, servers_to_load) = { let doc = doc!(event.editor, &doc_id); - let servers_to_load = doc - .language_config() - .map(|lang| !lang.language_servers.is_empty() || lang.debugger.is_some()) - .unwrap_or(false); - (doc.workspace_root().to_path_buf(), servers_to_load) + (doc.workspace_root().to_path_buf(), doc.servers_to_load()) }; // Stale: `.helix/` was edited since the user last ran `trust`. LSPs keep diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 5127a7be..3bd66f94 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1175,7 +1175,7 @@ fn workspace_trust_indicator_visible(editor: &Editor) -> bool { let (_, doc) = helix_view::current_ref!(editor); editor .workspace_trust - .workspace_restricted(doc.workspace_root()) + .restricted_for_doc(doc.workspace_root(), doc.servers_to_load()) } impl EditorView { diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 311188eb..72aa97f9 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1979,6 +1979,12 @@ impl Document { self.language_servers().any(|l| l.id() == id) } + pub fn servers_to_load(&self) -> bool { + self.language_config() + .map(|lang| !lang.language_servers.is_empty() || lang.debugger.is_some()) + .unwrap_or(false) + } + pub fn diff_handle(&self) -> Option<&DiffHandle> { self.diff_handle.as_ref() }