mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Cleanup lsp extensions on the client side
This commit is contained in:
parent
8686d0b0ac
commit
a30bdd9795
9 changed files with 93 additions and 137 deletions
|
@ -50,7 +50,7 @@ impl Request for ExpandMacro {
|
|||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExpandMacroParams {
|
||||
pub text_document: TextDocumentIdentifier,
|
||||
pub position: Option<Position>,
|
||||
pub position: Position,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
|
|
|
@ -72,15 +72,10 @@ pub fn handle_expand_macro(
|
|||
let _p = profile("handle_expand_macro");
|
||||
let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
||||
let line_index = world.analysis().file_line_index(file_id)?;
|
||||
let offset = params.position.map(|p| from_proto::offset(&line_index, p));
|
||||
let offset = from_proto::offset(&line_index, params.position);
|
||||
|
||||
match offset {
|
||||
None => Ok(None),
|
||||
Some(offset) => {
|
||||
let res = world.analysis().expand_macro(FilePosition { file_id, offset })?;
|
||||
Ok(res.map(|it| lsp_ext::ExpandedMacro { name: it.name, expansion: it.expansion }))
|
||||
}
|
||||
}
|
||||
let res = world.analysis().expand_macro(FilePosition { file_id, offset })?;
|
||||
Ok(res.map(|it| lsp_ext::ExpandedMacro { name: it.name, expansion: it.expansion }))
|
||||
}
|
||||
|
||||
pub fn handle_selection_range(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue