aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs1
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs23
-rw-r--r--crates/ra_lsp_server/src/req.rs21
3 files changed, 1 insertions, 44 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 9d540a87e..b9c99a223 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -346,7 +346,6 @@ fn on_request(
346 })? 346 })?
347 .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)? 347 .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)?
348 .on::<req::SyntaxTree>(handlers::handle_syntax_tree)? 348 .on::<req::SyntaxTree>(handlers::handle_syntax_tree)?
349 .on::<req::ExtendSelection>(handlers::handle_extend_selection)?
350 .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)? 349 .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)?
351 .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)? 350 .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)?
352 .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)? 351 .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)?
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 4ac051c96..a3d3f167c 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -9,7 +9,7 @@ use lsp_types::{
9 TextEdit, WorkspaceEdit, 9 TextEdit, WorkspaceEdit,
10}; 10};
11use ra_ide_api::{ 11use ra_ide_api::{
12 AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, Runnable, RunnableKind, 12 AssistId, FileId, FilePosition, FileRange, FoldKind, Query, Runnable, RunnableKind,
13}; 13};
14use ra_prof::profile; 14use ra_prof::profile;
15use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; 15use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit};
@@ -45,27 +45,6 @@ pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) -
45 Ok(res) 45 Ok(res)
46} 46}
47 47
48// FIXME: drop this API
49pub fn handle_extend_selection(
50 world: WorldSnapshot,
51 params: req::ExtendSelectionParams,
52) -> Result<req::ExtendSelectionResult> {
53 log::error!(
54 "extend selection is deprecated and will be removed soon,
55 use the new selection range API in LSP",
56 );
57 let file_id = params.text_document.try_conv_with(&world)?;
58 let line_index = world.analysis().file_line_index(file_id)?;
59 let selections = params
60 .selections
61 .into_iter()
62 .map_conv_with(&line_index)
63 .map(|range| FileRange { file_id, range })
64 .map(|frange| world.analysis().extend_selection(frange).map(|it| it.conv_with(&line_index)))
65 .collect::<Cancelable<Vec<_>>>()?;
66 Ok(req::ExtendSelectionResult { selections })
67}
68
69pub fn handle_selection_range( 48pub fn handle_selection_range(
70 world: WorldSnapshot, 49 world: WorldSnapshot,
71 params: req::SelectionRangeParams, 50 params: req::SelectionRangeParams,
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs
index 6b986bcc9..b2f3c509d 100644
--- a/crates/ra_lsp_server/src/req.rs
+++ b/crates/ra_lsp_server/src/req.rs
@@ -43,27 +43,6 @@ pub struct SyntaxTreeParams {
43 pub range: Option<Range>, 43 pub range: Option<Range>,
44} 44}
45 45
46pub enum ExtendSelection {}
47
48impl Request for ExtendSelection {
49 type Params = ExtendSelectionParams;
50 type Result = ExtendSelectionResult;
51 const METHOD: &'static str = "rust-analyzer/extendSelection";
52}
53
54#[derive(Deserialize, Debug)]
55#[serde(rename_all = "camelCase")]
56pub struct ExtendSelectionParams {
57 pub text_document: TextDocumentIdentifier,
58 pub selections: Vec<Range>,
59}
60
61#[derive(Serialize, Debug)]
62#[serde(rename_all = "camelCase")]
63pub struct ExtendSelectionResult {
64 pub selections: Vec<Range>,
65}
66
67pub enum SelectionRangeRequest {} 46pub enum SelectionRangeRequest {}
68 47
69impl Request for SelectionRangeRequest { 48impl Request for SelectionRangeRequest {