From 2f2267553769bd7c63ab49c85e4c67a7339355c3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Dec 2020 14:11:42 +0300 Subject: 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. --- crates/ide/src/lib.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'crates/ide/src/lib.rs') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index a75cc85b6..41eb139d1 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -79,7 +79,7 @@ pub use crate::{ HighlightedRange, }, }; -pub use assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; +pub use assists::{Assist, AssistConfig, AssistId, AssistKind}; pub use completion::{ CompletionConfig, CompletionItem, CompletionItemKind, CompletionResolveCapability, CompletionScore, ImportEdit, InsertTextFormat, @@ -491,22 +491,16 @@ impl Analysis { } /// Computes assists (aka code actions aka intentions) for the given - /// position. Computes enough info to show the lightbulb list in the editor, - /// but doesn't compute actual edits, to improve performance. - /// - /// When the user clicks on the assist, call `resolve_assists` to get the - /// edit. - pub fn assists(&self, config: &AssistConfig, frange: FileRange) -> Cancelable> { - self.with_db(|db| Assist::unresolved(db, config, frange)) - } - - /// Computes resolved assists with source changes for the given position. - pub fn resolve_assists( + /// position. If `resolve == false`, computes enough info to show the + /// lightbulb list in the editor, but doesn't compute actual edits, to + /// improve performance. + pub fn assists( &self, config: &AssistConfig, + resolve: bool, frange: FileRange, - ) -> Cancelable> { - self.with_db(|db| assists::Assist::resolved(db, config, frange)) + ) -> Cancelable> { + self.with_db(|db| Assist::get(db, config, resolve, frange)) } /// Computes the set of diagnostics for the given file. -- cgit v1.2.3