Skip to content

Commit

Permalink
Auto merge of #16435 - SomeoneToIgnore:less_resolve_data, r=lnicola
Browse files Browse the repository at this point in the history
Do not return code lens data after resolving
  • Loading branch information
bors committed Jan 27, 2024
2 parents 596e5c7 + ad5e2cf commit 4a23744
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/rust-analyzer/src/handlers/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,9 @@ pub(crate) fn handle_code_lens_resolve(
snap: GlobalStateSnapshot,
code_lens: CodeLens,
) -> anyhow::Result<CodeLens> {
if code_lens.data.is_none() {
return Ok(code_lens);
}
let Some(annotation) = from_proto::annotation(&snap, code_lens.clone())? else {
return Ok(code_lens);
};
Expand All @@ -1327,13 +1330,14 @@ pub(crate) fn handle_code_lens_resolve(
let mut acc = Vec::new();
to_proto::code_lens(&mut acc, &snap, annotation)?;

let res = match acc.pop() {
let mut res = match acc.pop() {
Some(it) if acc.is_empty() => it,
_ => {
never!();
code_lens
}
};
res.data = None;

Ok(res)
}
Expand Down

0 comments on commit 4a23744

Please sign in to comment.