mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
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 <kjeremy@gmail.com>
This commit is contained in:
commit
408b5fafc5
2 changed files with 25 additions and 21 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -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",
|
||||
|
|
|
@ -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::request::RegisterCapability>(
|
||||
lsp_types::RegistrationParams { registrations: vec![registration] },
|
||||
|
|
Loading…
Reference in a new issue