lsp: doc.language_server() is None until initialize completes

pull/724/head
Blaž Hrastnik 3 years ago
parent 46f3c69f06
commit 37606bad47

@ -93,6 +93,10 @@ impl Client {
}
}
pub fn is_initialized(&self) -> bool {
self.capabilities.get().is_some()
}
pub fn capabilities(&self) -> &lsp::ServerCapabilities {
self.capabilities
.get()

@ -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]

Loading…
Cancel
Save