Honor client's dynamic registration caps

cc https://github.com/rust-analyzer/rust-analyzer/pull/5516#issuecomment-757520828
This commit is contained in:
Aleksey Kladov
2021-01-10 22:38:35 +03:00
parent 035fed5f9f
commit bb453edebe
3 changed files with 70 additions and 51 deletions

View File

@@ -334,6 +334,18 @@ impl Config {
}
}
pub fn did_save_text_document_dynamic_registration(&self) -> bool {
let caps =
try_or!(self.caps.text_document.as_ref()?.synchronization.clone()?, Default::default());
caps.did_save == Some(true) && caps.dynamic_registration == Some(true)
}
pub fn did_change_watched_files_dynamic_registration(&self) -> bool {
try_or!(
self.caps.workspace.as_ref()?.did_change_watched_files.as_ref()?.dynamic_registration?,
false
)
}
pub fn location_link(&self) -> bool {
try_or!(self.caps.text_document.as_ref()?.definition?.link_support?, false)
}