From 58768b2a6343451bae8c4efb93ce7b1d598c914d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 11 Dec 2019 17:37:32 +0100 Subject: Revert "Support LSP 3.15" This reverts commit fcccf8ec59420d20edc53f7d787f2412e297f5fe. This causes rust-analyzer die immediatelly after startup --- crates/ra_lsp_server/Cargo.toml | 2 +- crates/ra_lsp_server/src/caps.rs | 7 +------ crates/ra_lsp_server/src/main_loop.rs | 3 +-- crates/ra_lsp_server/src/main_loop/handlers.rs | 5 +---- crates/ra_lsp_server/tests/heavy_tests/main.rs | 21 +-------------------- 5 files changed, 5 insertions(+), 33 deletions(-) (limited to 'crates') diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index c50cb8031..41672eaff 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -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.63.0", features = ["proposed"] } +lsp-types = { version = "0.61.0", features = ["proposed"] } rustc-hash = "1.0" parking_lot = "0.10.0" jod-thread = "0.1.0" diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs index 4cb259360..eea0965ed 100644 --- a/crates/ra_lsp_server/src/caps.rs +++ b/crates/ra_lsp_server/src/caps.rs @@ -5,7 +5,7 @@ use lsp_types::{ DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, GenericCapability, ImplementationProviderCapability, RenameOptions, RenameProviderCapability, ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind, - TextDocumentSyncOptions, TypeDefinitionProviderCapability, WorkDoneProgressOptions, + TextDocumentSyncOptions, TypeDefinitionProviderCapability, }; pub fn server_capabilities() -> ServerCapabilities { @@ -21,14 +21,10 @@ 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)), @@ -48,7 +44,6 @@ 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, diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 158cac0be..83845f1e0 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -520,8 +520,7 @@ 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(), version: None }; + let params = req::PublishDiagnosticsParams { uri, diagnostics: Vec::new() }; let not = notification_new::(params); msg_sender.send(not.into()).unwrap(); return Ok(()); diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 5b64b27cd..409583634 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -648,7 +648,6 @@ pub fn handle_code_action( diagnostics: None, edit: None, command: Some(command), - is_preferred: None, }; res.push(action.into()); } @@ -671,7 +670,6 @@ pub fn handle_code_action( diagnostics: None, edit: None, command: Some(command), - is_preferred: None, }; res.push(action.into()); } @@ -830,10 +828,9 @@ pub fn publish_diagnostics( source: Some("rust-analyzer".to_string()), message: d.message, related_information: None, - tags: None, }) .collect(); - Ok(req::PublishDiagnosticsParams { uri, diagnostics, version: None }) + Ok(req::PublishDiagnosticsParams { uri, diagnostics }) } pub fn publish_decorations( diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index dff63a12d..cfbf16ea5 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs @@ -4,8 +4,7 @@ use std::{collections::HashMap, time::Instant}; use lsp_types::{ CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions, - PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams, - WorkDoneProgressParams, + Position, Range, TextDocumentItem, TextDocumentPositionParams, }; use ra_lsp_server::req::{ CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument, @@ -49,8 +48,6 @@ 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()); @@ -214,12 +211,8 @@ 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!([ { @@ -279,11 +272,7 @@ 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!([ { @@ -336,8 +325,6 @@ 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!([ { @@ -369,8 +356,6 @@ 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!([]), ); @@ -419,8 +404,6 @@ 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!([ { @@ -452,8 +435,6 @@ 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!([]), ); -- cgit v1.2.3