From e293a16d6b430befe6eb8be315ad60e7b2b10926 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Sun, 23 Sep 2018 11:10:57 -0400 Subject: Support LSP 3.13 --- crates/ra_lsp_server/Cargo.toml | 2 +- crates/ra_lsp_server/src/caps.rs | 6 +++++- crates/ra_lsp_server/src/main_loop/handlers.rs | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index b851f70e1..32463e499 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -15,7 +15,7 @@ crossbeam-channel = "0.2.4" flexi_logger = "0.9.1" log = "0.4.3" url_serde = "0.2.0" -languageserver-types = "0.50.0" +languageserver-types = "0.51.0" walkdir = "2.2.0" im = "12.0.0" cargo_metadata = "0.6.0" diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs index 7456aea8a..3c628f29c 100644 --- a/crates/ra_lsp_server/src/caps.rs +++ b/crates/ra_lsp_server/src/caps.rs @@ -1,5 +1,7 @@ use languageserver_types::{ ServerCapabilities, + CodeActionProviderCapability, + FoldingRangeProviderCapability, TextDocumentSyncCapability, TextDocumentSyncOptions, TextDocumentSyncKind, @@ -32,7 +34,7 @@ pub fn server_capabilities() -> ServerCapabilities { document_highlight_provider: None, document_symbol_provider: Some(true), workspace_symbol_provider: Some(true), - code_action_provider: Some(true), + code_action_provider: Some(CodeActionProviderCapability::Simple(true)), code_lens_provider: None, document_formatting_provider: None, document_range_formatting_provider: None, @@ -40,10 +42,12 @@ pub fn server_capabilities() -> ServerCapabilities { first_trigger_character: "=".to_string(), more_trigger_character: None, }), + folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)), rename_provider: None, color_provider: None, execute_command_provider: Some(ExecuteCommandOptions { commands: vec!["apply_code_action".to_string()], }), + workspace: None, } } diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index b2ebc9cdc..2d9391859 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use languageserver_types::{ Diagnostic, DiagnosticSeverity, DocumentSymbol, - Command, TextDocumentIdentifier, + CodeActionResponse, Command, TextDocumentIdentifier, SymbolInformation, Position, Location, TextEdit, CompletionItem, InsertTextFormat, CompletionItemKind, }; @@ -369,7 +369,7 @@ pub fn handle_code_action( world: ServerWorld, params: req::CodeActionParams, _token: JobToken, -) -> Result>> { +) -> Result> { let file_id = params.text_document.try_conv_with(&world)?; let line_index = world.analysis().file_line_index(file_id); let range = params.range.conv_with(&line_index); @@ -392,7 +392,7 @@ pub fn handle_code_action( res.push(cmd); } - Ok(Some(res)) + Ok(Some(CodeActionResponse::Commands(res))) } pub fn publish_diagnostics( -- cgit v1.2.3