summaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/document.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 71f6680c..362a433e 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -798,9 +798,18 @@ impl Document {
self.version
}
- #[inline]
pub fn language_server(&self) -> Option<&helix_lsp::Client> {
- self.language_server.as_deref()
+ let server = self.language_server.as_deref();
+ let initialized = server
+ .map(|server| server.is_initialized())
+ .unwrap_or(false);
+
+ // only resolve language_server if it's initialized
+ if initialized {
+ server
+ } else {
+ None
+ }
}
#[inline]