fix sync did change effective caps
This commit is contained in:
parent
6f69765172
commit
e047398756
2 changed files with 15 additions and 13 deletions
|
@ -27,20 +27,21 @@ impl EffectiveCapability for cap::DidChangeTextDocument {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|id_to_sync_kind_map| {
|
.and_then(|id_to_sync_kind_map| {
|
||||||
if id_to_sync_kind_map.is_empty() {
|
if id_to_sync_kind_map.is_empty() {
|
||||||
None
|
return None;
|
||||||
} else {
|
}
|
||||||
let mut best: Option<TextDocumentSyncKind> = None;
|
let mut has_incremental = false;
|
||||||
for kind in id_to_sync_kind_map.values() {
|
for &kind in id_to_sync_kind_map.values() {
|
||||||
best = Some(match (best, kind) {
|
if kind == TextDocumentSyncKind::FULL {
|
||||||
(None, kind) => *kind,
|
return Some(TextDocumentSyncKind::FULL);
|
||||||
(
|
|
||||||
Some(TextDocumentSyncKind::FULL),
|
|
||||||
&TextDocumentSyncKind::INCREMENTAL,
|
|
||||||
) => TextDocumentSyncKind::INCREMENTAL,
|
|
||||||
(Some(kind), _) => kind,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
best
|
if kind == TextDocumentSyncKind::INCREMENTAL {
|
||||||
|
has_incremental = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if has_incremental {
|
||||||
|
Some(TextDocumentSyncKind::INCREMENTAL)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
|
|
|
@ -1148,6 +1148,7 @@ impl LanguageServer {
|
||||||
update(self.dynamic_capabilities.write().deref_mut());
|
update(self.dynamic_capabilities.write().deref_mut());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get effective capabilities by combining static and dynamic capabilities.
|
||||||
pub fn effective_capability<Cap: EffectiveCapability>(&self) -> Cap::Value {
|
pub fn effective_capability<Cap: EffectiveCapability>(&self) -> Cap::Value {
|
||||||
let static_capabilities = self.capabilities();
|
let static_capabilities = self.capabilities();
|
||||||
let dynamic_capabilities = self.dynamic_capabilities.read().clone();
|
let dynamic_capabilities = self.dynamic_capabilities.read().clone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue