aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/handlers.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-12-26 11:11:42 +0000
committerAleksey Kladov <[email protected]>2020-12-26 11:11:42 +0000
commit2f2267553769bd7c63ab49c85e4c67a7339355c3 (patch)
tree107c3baf8ac0d8b386f7b1441544011e23caf70b /crates/rust-analyzer/src/handlers.rs
parent44893bbcc58abc630e5263d3261236ca1cc21041 (diff)
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.
Diffstat (limited to 'crates/rust-analyzer/src/handlers.rs')
-rw-r--r--crates/rust-analyzer/src/handlers.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 1207b31c4..374fb5302 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -946,12 +946,12 @@ pub(crate) fn handle_code_action(
946 946
947 if snap.config.client_caps.code_action_resolve { 947 if snap.config.client_caps.code_action_resolve {
948 for (index, assist) in 948 for (index, assist) in
949 snap.analysis.assists(&assists_config, frange)?.into_iter().enumerate() 949 snap.analysis.assists(&assists_config, false, frange)?.into_iter().enumerate()
950 { 950 {
951 res.push(to_proto::unresolved_code_action(&snap, params.clone(), assist, index)?); 951 res.push(to_proto::unresolved_code_action(&snap, params.clone(), assist, index)?);
952 } 952 }
953 } else { 953 } else {
954 for assist in snap.analysis.resolve_assists(&assists_config, frange)?.into_iter() { 954 for assist in snap.analysis.assists(&assists_config, true, frange)?.into_iter() {
955 res.push(to_proto::resolved_code_action(&snap, assist)?); 955 res.push(to_proto::resolved_code_action(&snap, assist)?);
956 } 956 }
957 } 957 }
@@ -1014,11 +1014,11 @@ pub(crate) fn handle_code_action_resolve(
1014 .only 1014 .only
1015 .map(|it| it.into_iter().filter_map(from_proto::assist_kind).collect()); 1015 .map(|it| it.into_iter().filter_map(from_proto::assist_kind).collect());
1016 1016
1017 let assists = snap.analysis.resolve_assists(&snap.config.assist, frange)?; 1017 let assists = snap.analysis.assists(&snap.config.assist, true, frange)?;
1018 let (id, index) = split_once(&params.id, ':').unwrap(); 1018 let (id, index) = split_once(&params.id, ':').unwrap();
1019 let index = index.parse::<usize>().unwrap(); 1019 let index = index.parse::<usize>().unwrap();
1020 let assist = &assists[index]; 1020 let assist = &assists[index];
1021 assert!(assist.assist.id.0 == id); 1021 assert!(assist.id.0 == id);
1022 let edit = to_proto::resolved_code_action(&snap, assist.clone())?.edit; 1022 let edit = to_proto::resolved_code_action(&snap, assist.clone())?.edit;
1023 code_action.edit = edit; 1023 code_action.edit = edit;
1024 Ok(code_action) 1024 Ok(code_action)