aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-14 16:26:10 +0100
committerGitHub <[email protected]>2020-07-14 16:26:10 +0100
commit408b5fafc5fa6e18dc61a6e7a514692ae4352b0e (patch)
treed7fb2f09eddfc0eeaba2daa984eff1c97ab7e604
parent5d17dfee2f042e33672c17710eaa2d36278599a3 (diff)
parent2257a48cd36c61f887b881edf44df7fd260a52fc (diff)
Merge #5375
5375: Use more explicit type for save registration r=matklad a=kjeremy This was introduced in the latest lsp-types Co-authored-by: kjeremy <[email protected]>
-rw-r--r--Cargo.lock4
-rw-r--r--crates/rust-analyzer/src/main_loop.rs42
2 files changed, 25 insertions, 21 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c16cf4bc8..11eb9a823 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -712,9 +712,9 @@ dependencies = [
712 712
713[[package]] 713[[package]]
714name = "lsp-types" 714name = "lsp-types"
715version = "0.76.0" 715version = "0.76.1"
716source = "registry+https://github.com/rust-lang/crates.io-index" 716source = "registry+https://github.com/rust-lang/crates.io-index"
717checksum = "af5586f0631c7f7826c3ea39377c326d7b4623138be7ab1204dab22e47717449" 717checksum = "55cfa1593e04985972e018890b2e1a9ed25c71efc800067fbf0990a9432421c8"
718dependencies = [ 718dependencies = [
719 "base64", 719 "base64",
720 "bitflags", 720 "bitflags",
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 702f25a19..5afcc2d87 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -122,29 +122,33 @@ impl GlobalState {
122 ); 122 );
123 }; 123 };
124 124
125 let registration_options = lsp_types::TextDocumentRegistrationOptions { 125 let save_registration_options = lsp_types::TextDocumentSaveRegistrationOptions {
126 document_selector: Some(vec![ 126 include_text: Some(false),
127 lsp_types::DocumentFilter { 127 text_document_registration_options: lsp_types::TextDocumentRegistrationOptions {
128 language: None, 128 document_selector: Some(vec![
129 scheme: None, 129 lsp_types::DocumentFilter {
130 pattern: Some("**/*.rs".into()), 130 language: None,
131 }, 131 scheme: None,
132 lsp_types::DocumentFilter { 132 pattern: Some("**/*.rs".into()),
133 language: None, 133 },
134 scheme: None, 134 lsp_types::DocumentFilter {
135 pattern: Some("**/Cargo.toml".into()), 135 language: None,
136 }, 136 scheme: None,
137 lsp_types::DocumentFilter { 137 pattern: Some("**/Cargo.toml".into()),
138 language: None, 138 },
139 scheme: None, 139 lsp_types::DocumentFilter {
140 pattern: Some("**/Cargo.lock".into()), 140 language: None,
141 }, 141 scheme: None,
142 ]), 142 pattern: Some("**/Cargo.lock".into()),
143 },
144 ]),
145 },
143 }; 146 };
147
144 let registration = lsp_types::Registration { 148 let registration = lsp_types::Registration {
145 id: "textDocument/didSave".to_string(), 149 id: "textDocument/didSave".to_string(),
146 method: "textDocument/didSave".to_string(), 150 method: "textDocument/didSave".to_string(),
147 register_options: Some(serde_json::to_value(registration_options).unwrap()), 151 register_options: Some(serde_json::to_value(save_registration_options).unwrap()),
148 }; 152 };
149 self.send_request::<lsp_types::request::RegisterCapability>( 153 self.send_request::<lsp_types::request::RegisterCapability>(
150 lsp_types::RegistrationParams { registrations: vec![registration] }, 154 lsp_types::RegistrationParams { registrations: vec![registration] },