5375: Use more explicit type for save registration r=matklad a=kjeremy

This was introduced in the latest lsp-types

Co-authored-by: kjeremy <kjeremy@gmail.com>
This commit is contained in:
bors[bot] 2020-07-14 15:26:10 +00:00 committed by GitHub
commit 408b5fafc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 21 deletions

4
Cargo.lock generated
View file

@ -712,9 +712,9 @@ dependencies = [
[[package]] [[package]]
name = "lsp-types" name = "lsp-types"
version = "0.76.0" version = "0.76.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af5586f0631c7f7826c3ea39377c326d7b4623138be7ab1204dab22e47717449" checksum = "55cfa1593e04985972e018890b2e1a9ed25c71efc800067fbf0990a9432421c8"
dependencies = [ dependencies = [
"base64", "base64",
"bitflags", "bitflags",

View file

@ -122,7 +122,9 @@ impl GlobalState {
); );
}; };
let registration_options = lsp_types::TextDocumentRegistrationOptions { let save_registration_options = lsp_types::TextDocumentSaveRegistrationOptions {
include_text: Some(false),
text_document_registration_options: lsp_types::TextDocumentRegistrationOptions {
document_selector: Some(vec![ document_selector: Some(vec![
lsp_types::DocumentFilter { lsp_types::DocumentFilter {
language: None, language: None,
@ -140,11 +142,13 @@ impl GlobalState {
pattern: Some("**/Cargo.lock".into()), pattern: Some("**/Cargo.lock".into()),
}, },
]), ]),
},
}; };
let registration = lsp_types::Registration { let registration = lsp_types::Registration {
id: "textDocument/didSave".to_string(), id: "textDocument/didSave".to_string(),
method: "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::request::RegisterCapability>( self.send_request::<lsp_types::request::RegisterCapability>(
lsp_types::RegistrationParams { registrations: vec![registration] }, lsp_types::RegistrationParams { registrations: vec![registration] },