Cleanup lsp extensions on the client side

This commit is contained in:
Aleksey Kladov 2020-05-25 14:56:26 +02:00
parent 8686d0b0ac
commit a30bdd9795
9 changed files with 93 additions and 137 deletions

View file

@ -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)]

View file

@ -72,15 +72,10 @@ pub fn handle_expand_macro(
let _p = profile("handle_expand_macro");
let file_id = from_proto::file_id(&world, &params.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(