From 5e876095e98f5b782f4d1259e5b397bfd14547da Mon Sep 17 00:00:00 2001 From: Junfeng Li Date: Mon, 1 Jan 2018 12:22:39 -0800 Subject: [PATCH] Upgrade languageserver-types. Close #217. Close #238. --- Cargo.lock | 8 ++++---- src/languageclient.rs | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8da08beb..8ce701184 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,14 +218,14 @@ dependencies = [ [[package]] name = "languageclient" -version = "0.1.12" +version = "0.1.13" dependencies = [ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "languageserver-types 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "languageserver-types 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -243,7 +243,7 @@ dependencies = [ [[package]] name = "languageserver-types" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -717,7 +717,7 @@ dependencies = [ "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum languageserver-types 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "10ba1d941d793ff110dbd019012aec9e4b1511a82f25674b221b5dc29e257c05" +"checksum languageserver-types 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41b4e6ab471de4a14ccfa7cd61892859e00a944e5ddb706f28f562d1829024a0" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0" "checksum linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2aab0478615bb586559b0114d94dd8eca4fdbb73b443adcb0d00b61692b4bf" diff --git a/src/languageclient.rs b/src/languageclient.rs index aaa8484e9..ac5d291ff 100644 --- a/src/languageclient.rs +++ b/src/languageclient.rs @@ -559,8 +559,16 @@ impl ILanguageClient for Arc> { debug!("Begin apply WorkspaceEdit: {:?}", edit); let (filename, line, character): (String, u64, u64) = self.gather_args(&[VimVar::Filename, VimVar::Line, VimVar::Character], &None)?; - for (uri, edits) in &edit.changes { - self.apply_TextEdits(uri.path(), edits.as_slice())?; + + if let Some(ref changes) = edit.document_changes { + for e in changes { + self.apply_TextEdits(e.text_document.uri.path(), &e.edits)?; + } + } + if let Some(ref changes) = edit.changes { + for (uri, edits) in changes { + self.apply_TextEdits(uri.path(), edits)?; + } } debug!("End apply WorkspaceEdit"); self.goto_location(&filename, line, character)?;