Simplify assists resolution API
Assist vs UnresolvedAssist split doesn't really pull its weight. This is especially bad if we want to include `Assist` as a field of diagnostics, where we'd have to make the thing generic.
This commit is contained in:
@@ -946,12 +946,12 @@ pub(crate) fn handle_code_action(
|
||||
|
||||
if snap.config.client_caps.code_action_resolve {
|
||||
for (index, assist) in
|
||||
snap.analysis.assists(&assists_config, frange)?.into_iter().enumerate()
|
||||
snap.analysis.assists(&assists_config, false, frange)?.into_iter().enumerate()
|
||||
{
|
||||
res.push(to_proto::unresolved_code_action(&snap, params.clone(), assist, index)?);
|
||||
}
|
||||
} else {
|
||||
for assist in snap.analysis.resolve_assists(&assists_config, frange)?.into_iter() {
|
||||
for assist in snap.analysis.assists(&assists_config, true, frange)?.into_iter() {
|
||||
res.push(to_proto::resolved_code_action(&snap, assist)?);
|
||||
}
|
||||
}
|
||||
@@ -1014,11 +1014,11 @@ pub(crate) fn handle_code_action_resolve(
|
||||
.only
|
||||
.map(|it| it.into_iter().filter_map(from_proto::assist_kind).collect());
|
||||
|
||||
let assists = snap.analysis.resolve_assists(&snap.config.assist, frange)?;
|
||||
let assists = snap.analysis.assists(&snap.config.assist, true, frange)?;
|
||||
let (id, index) = split_once(¶ms.id, ':').unwrap();
|
||||
let index = index.parse::<usize>().unwrap();
|
||||
let assist = &assists[index];
|
||||
assert!(assist.assist.id.0 == id);
|
||||
assert!(assist.id.0 == id);
|
||||
let edit = to_proto::resolved_code_action(&snap, assist.clone())?.edit;
|
||||
code_action.edit = edit;
|
||||
Ok(code_action)
|
||||
|
||||
Reference in New Issue
Block a user