aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJeremy Kolb <[email protected]>2019-07-07 22:28:21 +0100
committerJeremy Kolb <[email protected]>2019-07-07 22:28:21 +0100
commit9c6e93cd6c108536015272b6a363ed5cc1d4fb44 (patch)
tree3da433526a8d98fa4913fb81423b47afa7c4fd65 /crates
parent3f44aaf363be0669e618a8340fd91b47ae6344c4 (diff)
Simplify responses by using into()
Diffstat (limited to 'crates')
-rw-r--r--crates/gen_lsp_server/Cargo.toml2
-rw-r--r--crates/ra_lsp_server/Cargo.toml2
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs23
3 files changed, 14 insertions, 13 deletions
diff --git a/crates/gen_lsp_server/Cargo.toml b/crates/gen_lsp_server/Cargo.toml
index 46b02a459..36a29265c 100644
--- a/crates/gen_lsp_server/Cargo.toml
+++ b/crates/gen_lsp_server/Cargo.toml
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
8description = "Generic LSP server scaffold." 8description = "Generic LSP server scaffold."
9 9
10[dependencies] 10[dependencies]
11lsp-types = { git = "https://github.com/kjeremy/languageserver-types", branch = "flatten" } 11lsp-types = "0.59.0"
12log = "0.4.3" 12log = "0.4.3"
13serde_json = "1.0.34" 13serde_json = "1.0.34"
14serde = { version = "1.0.83", features = ["derive"] } 14serde = { version = "1.0.83", features = ["derive"] }
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml
index 9c9dda01f..50bc8111b 100644
--- a/crates/ra_lsp_server/Cargo.toml
+++ b/crates/ra_lsp_server/Cargo.toml
@@ -13,7 +13,7 @@ crossbeam-channel = "0.3.5"
13flexi_logger = "0.13.0" 13flexi_logger = "0.13.0"
14log = "0.4.3" 14log = "0.4.3"
15url_serde = "0.2.0" 15url_serde = "0.2.0"
16lsp-types = { git = "https://github.com/kjeremy/languageserver-types", branch = "flatten", features = ["proposed"] } 16lsp-types = { version = "0.59.0", features = ["proposed"] }
17rustc-hash = "1.0" 17rustc-hash = "1.0"
18parking_lot = "0.8.0" 18parking_lot = "0.8.0"
19 19
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 6b407cb0c..62c8cbf71 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -2,11 +2,11 @@ use std::{fmt::Write as _, io::Write as _};
2 2
3use gen_lsp_server::ErrorCode; 3use gen_lsp_server::ErrorCode;
4use lsp_types::{ 4use lsp_types::{
5 CodeAction, CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, 5 CodeAction, CodeActionResponse, CodeLens, Command, CompletionItem, Diagnostic,
6 DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeKind, 6 DiagnosticSeverity, DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange,
7 FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, 7 FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent,
8 PrepareRenameResponse, Range, RenameParams, SymbolInformation, TextDocumentIdentifier, 8 MarkupKind, Position, PrepareRenameResponse, Range, RenameParams, SymbolInformation,
9 TextEdit, WorkspaceEdit, 9 TextDocumentIdentifier, TextEdit, WorkspaceEdit,
10}; 10};
11use ra_ide_api::{ 11use ra_ide_api::{
12 AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, 12 AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo,
@@ -212,7 +212,7 @@ pub fn handle_document_symbol(
212 } 212 }
213 } 213 }
214 214
215 Ok(Some(req::DocumentSymbolResponse::Nested(res))) 215 Ok(Some(res.into()))
216} 216}
217 217
218pub fn handle_workspace_symbol( 218pub fn handle_workspace_symbol(
@@ -275,7 +275,7 @@ pub fn handle_goto_definition(
275 .map(|nav| RangeInfo::new(nav_range, nav)) 275 .map(|nav| RangeInfo::new(nav_range, nav))
276 .map(|nav| to_location_link(&nav, &world, &line_index)) 276 .map(|nav| to_location_link(&nav, &world, &line_index))
277 .collect::<Result<Vec<_>>>()?; 277 .collect::<Result<Vec<_>>>()?;
278 Ok(Some(req::GotoDefinitionResponse::Link(res))) 278 Ok(Some(res.into()))
279} 279}
280 280
281pub fn handle_goto_implementation( 281pub fn handle_goto_implementation(
@@ -295,7 +295,7 @@ pub fn handle_goto_implementation(
295 .map(|nav| RangeInfo::new(nav_range, nav)) 295 .map(|nav| RangeInfo::new(nav_range, nav))
296 .map(|nav| to_location_link(&nav, &world, &line_index)) 296 .map(|nav| to_location_link(&nav, &world, &line_index))
297 .collect::<Result<Vec<_>>>()?; 297 .collect::<Result<Vec<_>>>()?;
298 Ok(Some(req::GotoDefinitionResponse::Link(res))) 298 Ok(Some(res.into()))
299} 299}
300 300
301pub fn handle_goto_type_definition( 301pub fn handle_goto_type_definition(
@@ -315,7 +315,7 @@ pub fn handle_goto_type_definition(
315 .map(|nav| RangeInfo::new(nav_range, nav)) 315 .map(|nav| RangeInfo::new(nav_range, nav))
316 .map(|nav| to_location_link(&nav, &world, &line_index)) 316 .map(|nav| to_location_link(&nav, &world, &line_index))
317 .collect::<Result<Vec<_>>>()?; 317 .collect::<Result<Vec<_>>>()?;
318 Ok(Some(req::GotoDefinitionResponse::Link(res))) 318 Ok(Some(res.into()))
319} 319}
320 320
321pub fn handle_parent_module( 321pub fn handle_parent_module(
@@ -433,9 +433,10 @@ pub fn handle_completion(
433 Some(items) => items, 433 Some(items) => items,
434 }; 434 };
435 let line_index = world.analysis().file_line_index(position.file_id); 435 let line_index = world.analysis().file_line_index(position.file_id);
436 let items = items.into_iter().map(|item| item.conv_with(&line_index)).collect(); 436 let items: Vec<CompletionItem> =
437 items.into_iter().map(|item| item.conv_with(&line_index)).collect();
437 438
438 Ok(Some(req::CompletionResponse::Array(items))) 439 Ok(Some(items.into()))
439} 440}
440 441
441pub fn handle_folding_range( 442pub fn handle_folding_range(