mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Drop support for old extendSelection API
Emacs now handles this via native LSP request
dc86bbb227
This commit is contained in:
parent
cce31580e1
commit
13eddd7c49
4 changed files with 4 additions and 73 deletions
|
@ -346,7 +346,6 @@ fn on_request(
|
|||
})?
|
||||
.on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)?
|
||||
.on::<req::SyntaxTree>(handlers::handle_syntax_tree)?
|
||||
.on::<req::ExtendSelection>(handlers::handle_extend_selection)?
|
||||
.on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)?
|
||||
.on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)?
|
||||
.on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)?
|
||||
|
|
|
@ -9,7 +9,7 @@ use lsp_types::{
|
|||
TextEdit, WorkspaceEdit,
|
||||
};
|
||||
use ra_ide_api::{
|
||||
AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, Runnable, RunnableKind,
|
||||
AssistId, FileId, FilePosition, FileRange, FoldKind, Query, Runnable, RunnableKind,
|
||||
};
|
||||
use ra_prof::profile;
|
||||
use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit};
|
||||
|
@ -45,27 +45,6 @@ pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) -
|
|||
Ok(res)
|
||||
}
|
||||
|
||||
// FIXME: drop this API
|
||||
pub fn handle_extend_selection(
|
||||
world: WorldSnapshot,
|
||||
params: req::ExtendSelectionParams,
|
||||
) -> Result<req::ExtendSelectionResult> {
|
||||
log::error!(
|
||||
"extend selection is deprecated and will be removed soon,
|
||||
use the new selection range API in LSP",
|
||||
);
|
||||
let file_id = params.text_document.try_conv_with(&world)?;
|
||||
let line_index = world.analysis().file_line_index(file_id)?;
|
||||
let selections = params
|
||||
.selections
|
||||
.into_iter()
|
||||
.map_conv_with(&line_index)
|
||||
.map(|range| FileRange { file_id, range })
|
||||
.map(|frange| world.analysis().extend_selection(frange).map(|it| it.conv_with(&line_index)))
|
||||
.collect::<Cancelable<Vec<_>>>()?;
|
||||
Ok(req::ExtendSelectionResult { selections })
|
||||
}
|
||||
|
||||
pub fn handle_selection_range(
|
||||
world: WorldSnapshot,
|
||||
params: req::SelectionRangeParams,
|
||||
|
|
|
@ -43,27 +43,6 @@ pub struct SyntaxTreeParams {
|
|||
pub range: Option<Range>,
|
||||
}
|
||||
|
||||
pub enum ExtendSelection {}
|
||||
|
||||
impl Request for ExtendSelection {
|
||||
type Params = ExtendSelectionParams;
|
||||
type Result = ExtendSelectionResult;
|
||||
const METHOD: &'static str = "rust-analyzer/extendSelection";
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExtendSelectionParams {
|
||||
pub text_document: TextDocumentIdentifier,
|
||||
pub selections: Vec<Range>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExtendSelectionResult {
|
||||
pub selections: Vec<Range>,
|
||||
}
|
||||
|
||||
pub enum SelectionRangeRequest {}
|
||||
|
||||
impl Request for SelectionRangeRequest {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue