From 2257a48cd36c61f887b881edf44df7fd260a52fc Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 14 Jul 2020 11:03:44 -0400 Subject: Use more explicity type for save registration --- Cargo.lock | 4 ++-- crates/rust-analyzer/src/main_loop.rs | 42 +++++++++++++++++++---------------- 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 = [ [[package]] name = "lsp-types" -version = "0.76.0" +version = "0.76.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af5586f0631c7f7826c3ea39377c326d7b4623138be7ab1204dab22e47717449" +checksum = "55cfa1593e04985972e018890b2e1a9ed25c71efc800067fbf0990a9432421c8" dependencies = [ "base64", "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 { ); }; - let registration_options = lsp_types::TextDocumentRegistrationOptions { - document_selector: Some(vec![ - lsp_types::DocumentFilter { - language: None, - scheme: None, - pattern: Some("**/*.rs".into()), - }, - lsp_types::DocumentFilter { - language: None, - scheme: None, - pattern: Some("**/Cargo.toml".into()), - }, - lsp_types::DocumentFilter { - language: None, - scheme: None, - pattern: Some("**/Cargo.lock".into()), - }, - ]), + let save_registration_options = lsp_types::TextDocumentSaveRegistrationOptions { + include_text: Some(false), + text_document_registration_options: lsp_types::TextDocumentRegistrationOptions { + document_selector: Some(vec![ + lsp_types::DocumentFilter { + language: None, + scheme: None, + pattern: Some("**/*.rs".into()), + }, + lsp_types::DocumentFilter { + language: None, + scheme: None, + pattern: Some("**/Cargo.toml".into()), + }, + lsp_types::DocumentFilter { + language: None, + scheme: None, + pattern: Some("**/Cargo.lock".into()), + }, + ]), + }, }; + let registration = lsp_types::Registration { id: "textDocument/didSave".to_string(), method: "textDocument/didSave".to_string(), - register_options: Some(serde_json::to_value(registration_options).unwrap()), + register_options: Some(serde_json::to_value(save_registration_options).unwrap()), }; self.send_request::( lsp_types::RegistrationParams { registrations: vec![registration] }, -- cgit v1.2.3