lsp: doc.language_server() is None until initialize completes
This commit is contained in:
parent
46f3c69f06
commit
37606bad47
@ -93,6 +93,10 @@ fn value_into_params(value: Value) -> jsonrpc::Params {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_initialized(&self) -> bool {
|
||||
self.capabilities.get().is_some()
|
||||
}
|
||||
|
||||
pub fn capabilities(&self) -> &lsp::ServerCapabilities {
|
||||
self.capabilities
|
||||
.get()
|
||||
|
@ -798,9 +798,18 @@ pub fn version(&self) -> i32 {
|
||||
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…
Reference in New Issue
Block a user