mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Support LSP 3.15
This merely upgrades our protocol support. It does not add any of the new features.
This commit is contained in:
parent
5202b0ecba
commit
712700d8e0
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -620,7 +620,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lsp-types"
|
||||
version = "0.61.0"
|
||||
version = "0.63.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1048,7 +1048,7 @@ dependencies = [
|
||||
"jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lsp-server 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lsp-types 0.61.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lsp-types 0.63.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ra_ide 0.1.0",
|
||||
"ra_prof 0.1.0",
|
||||
@ -1839,7 +1839,7 @@ dependencies = [
|
||||
"checksum lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e57b3997725d2b60dbec1297f6c2e2957cc383db1cebd6be812163f969c7d586"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum lsp-server 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ba36405bd742139ab79c246ca5adb7fde2fe1a0f495e2c8e2f607b607dedb12"
|
||||
"checksum lsp-types 0.61.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa3268fbe8beb2795c2fb327bf44f4f3d24f5fe9ebc18d7e2980afd444d72bcf"
|
||||
"checksum lsp-types 0.63.0 (registry+https://github.com/rust-lang/crates.io-index)" = "031d6b53a686f8eef69138f5b834b7eadadb0dd86f4c888504476ee1b17ae8d7"
|
||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
|
||||
"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9"
|
||||
|
@ -14,7 +14,7 @@ serde_json = "1.0.34"
|
||||
serde = { version = "1.0.83", features = ["derive"] }
|
||||
crossbeam-channel = "0.4"
|
||||
log = "0.4.3"
|
||||
lsp-types = { version = "0.61.0", features = ["proposed"] }
|
||||
lsp-types = { version = "0.63.0", features = ["proposed"] }
|
||||
rustc-hash = "1.0"
|
||||
parking_lot = "0.10.0"
|
||||
jod-thread = "0.1.0"
|
||||
|
@ -5,7 +5,7 @@ use lsp_types::{
|
||||
DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, GenericCapability,
|
||||
ImplementationProviderCapability, RenameOptions, RenameProviderCapability, ServerCapabilities,
|
||||
SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
|
||||
TextDocumentSyncOptions, TypeDefinitionProviderCapability,
|
||||
TextDocumentSyncOptions, TypeDefinitionProviderCapability, WorkDoneProgressOptions,
|
||||
};
|
||||
|
||||
pub fn server_capabilities() -> ServerCapabilities {
|
||||
@ -21,10 +21,14 @@ pub fn server_capabilities() -> ServerCapabilities {
|
||||
completion_provider: Some(CompletionOptions {
|
||||
resolve_provider: None,
|
||||
trigger_characters: Some(vec![":".to_string(), ".".to_string()]),
|
||||
work_done_progress_options: WorkDoneProgressOptions { work_done_progress: None },
|
||||
}),
|
||||
signature_help_provider: Some(SignatureHelpOptions {
|
||||
trigger_characters: Some(vec!["(".to_string(), ",".to_string(), ")".to_string()]),
|
||||
retrigger_characters: None,
|
||||
work_done_progress_options: WorkDoneProgressOptions { work_done_progress: None },
|
||||
}),
|
||||
declaration_provider: None,
|
||||
definition_provider: Some(true),
|
||||
type_definition_provider: Some(TypeDefinitionProviderCapability::Simple(true)),
|
||||
implementation_provider: Some(ImplementationProviderCapability::Simple(true)),
|
||||
@ -44,6 +48,7 @@ pub fn server_capabilities() -> ServerCapabilities {
|
||||
folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)),
|
||||
rename_provider: Some(RenameProviderCapability::Options(RenameOptions {
|
||||
prepare_provider: Some(true),
|
||||
work_done_progress_options: WorkDoneProgressOptions { work_done_progress: None },
|
||||
})),
|
||||
document_link_provider: None,
|
||||
color_provider: None,
|
||||
|
@ -520,7 +520,8 @@ fn on_notification(
|
||||
if let Some(file_id) = state.vfs.write().remove_file_overlay(path.as_path()) {
|
||||
subs.remove_sub(FileId(file_id.0));
|
||||
}
|
||||
let params = req::PublishDiagnosticsParams { uri, diagnostics: Vec::new() };
|
||||
let params =
|
||||
req::PublishDiagnosticsParams { uri, diagnostics: Vec::new(), version: None };
|
||||
let not = notification_new::<req::PublishDiagnostics>(params);
|
||||
msg_sender.send(not.into()).unwrap();
|
||||
return Ok(());
|
||||
|
@ -648,6 +648,7 @@ pub fn handle_code_action(
|
||||
diagnostics: None,
|
||||
edit: None,
|
||||
command: Some(command),
|
||||
is_preferred: None,
|
||||
};
|
||||
res.push(action.into());
|
||||
}
|
||||
@ -670,6 +671,7 @@ pub fn handle_code_action(
|
||||
diagnostics: None,
|
||||
edit: None,
|
||||
command: Some(command),
|
||||
is_preferred: None,
|
||||
};
|
||||
res.push(action.into());
|
||||
}
|
||||
@ -828,9 +830,10 @@ pub fn publish_diagnostics(
|
||||
source: Some("rust-analyzer".to_string()),
|
||||
message: d.message,
|
||||
related_information: None,
|
||||
tags: None,
|
||||
})
|
||||
.collect();
|
||||
Ok(req::PublishDiagnosticsParams { uri, diagnostics })
|
||||
Ok(req::PublishDiagnosticsParams { uri, diagnostics, version: None })
|
||||
}
|
||||
|
||||
pub fn publish_decorations(
|
||||
|
@ -4,7 +4,8 @@ use std::{collections::HashMap, time::Instant};
|
||||
|
||||
use lsp_types::{
|
||||
CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions,
|
||||
Position, Range, TextDocumentItem, TextDocumentPositionParams,
|
||||
PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams,
|
||||
WorkDoneProgressParams,
|
||||
};
|
||||
use ra_lsp_server::req::{
|
||||
CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument,
|
||||
@ -48,6 +49,8 @@ use std::collections::Spam;
|
||||
Position::new(0, 23),
|
||||
),
|
||||
context: None,
|
||||
partial_result_params: PartialResultParams::default(),
|
||||
work_done_progress_params: WorkDoneProgressParams::default(),
|
||||
});
|
||||
assert!(format!("{}", res).contains("HashMap"));
|
||||
eprintln!("completion took {:?}", completion_start.elapsed());
|
||||
@ -211,8 +214,12 @@ pub use std::collections::HashMap;
|
||||
options: FormattingOptions {
|
||||
tab_size: 4,
|
||||
insert_spaces: false,
|
||||
insert_final_newline: None,
|
||||
trim_final_newlines: None,
|
||||
trim_trailing_whitespace: None,
|
||||
properties: HashMap::new(),
|
||||
},
|
||||
work_done_progress_params: WorkDoneProgressParams::default(),
|
||||
},
|
||||
json!([
|
||||
{
|
||||
@ -272,7 +279,11 @@ pub use std::collections::HashMap;
|
||||
tab_size: 4,
|
||||
insert_spaces: false,
|
||||
properties: HashMap::new(),
|
||||
insert_final_newline: None,
|
||||
trim_final_newlines: None,
|
||||
trim_trailing_whitespace: None,
|
||||
},
|
||||
work_done_progress_params: WorkDoneProgressParams::default(),
|
||||
},
|
||||
json!([
|
||||
{
|
||||
@ -325,6 +336,8 @@ fn main() {}
|
||||
text_document: server.doc_id("src/lib.rs"),
|
||||
range: Range::new(Position::new(0, 4), Position::new(0, 7)),
|
||||
context: empty_context(),
|
||||
partial_result_params: PartialResultParams::default(),
|
||||
work_done_progress_params: WorkDoneProgressParams::default(),
|
||||
},
|
||||
json!([
|
||||
{
|
||||
@ -356,6 +369,8 @@ fn main() {}
|
||||
text_document: server.doc_id("src/lib.rs"),
|
||||
range: Range::new(Position::new(2, 4), Position::new(2, 7)),
|
||||
context: empty_context(),
|
||||
partial_result_params: PartialResultParams::default(),
|
||||
work_done_progress_params: WorkDoneProgressParams::default(),
|
||||
},
|
||||
json!([]),
|
||||
);
|
||||
@ -404,6 +419,8 @@ fn main() {{}}
|
||||
text_document: server.doc_id("src/lib.rs"),
|
||||
range: Range::new(Position::new(0, 4), Position::new(0, 7)),
|
||||
context: empty_context(),
|
||||
partial_result_params: PartialResultParams::default(),
|
||||
work_done_progress_params: WorkDoneProgressParams::default(),
|
||||
},
|
||||
json!([
|
||||
{
|
||||
@ -435,6 +452,8 @@ fn main() {{}}
|
||||
text_document: server.doc_id("src/lib.rs"),
|
||||
range: Range::new(Position::new(2, 4), Position::new(2, 7)),
|
||||
context: empty_context(),
|
||||
partial_result_params: PartialResultParams::default(),
|
||||
work_done_progress_params: WorkDoneProgressParams::default(),
|
||||
},
|
||||
json!([]),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user