aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-02 04:55:55 +0000
committerBlaž Hrastnik2021-09-06 06:25:46 +0000
commit37606bad47fe0e197cb34fc7d52856597c32ce33 (patch)
tree1c5a6f39ffee2ae446f5e64ebf22e8f93b8573dc /helix-view/src
parent46f3c69f06cc55f36bcc6244a9f96c2481836dea (diff)
lsp: doc.language_server() is None until initialize completes
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]