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,29 +122,33 @@ impl GlobalState {
); );
}; };
let registration_options = lsp_types::TextDocumentRegistrationOptions { let save_registration_options = lsp_types::TextDocumentSaveRegistrationOptions {
document_selector: Some(vec![ include_text: Some(false),
lsp_types::DocumentFilter { text_document_registration_options: lsp_types::TextDocumentRegistrationOptions {
language: None, document_selector: Some(vec![
scheme: None, lsp_types::DocumentFilter {
pattern: Some("**/*.rs".into()), language: None,
}, scheme: None,
lsp_types::DocumentFilter { pattern: Some("**/*.rs".into()),
language: None, },
scheme: None, lsp_types::DocumentFilter {
pattern: Some("**/Cargo.toml".into()), language: None,
}, scheme: None,
lsp_types::DocumentFilter { pattern: Some("**/Cargo.toml".into()),
language: None, },
scheme: None, lsp_types::DocumentFilter {
pattern: Some("**/Cargo.lock".into()), language: None,
}, scheme: None,
]), 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] },