aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
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/ide
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/ide')
-rw-r--r--crates/ide/src/lib.rs22
1 files changed, 8 insertions, 14 deletions
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::{
79 HighlightedRange, 79 HighlightedRange,
80 }, 80 },
81}; 81};
82pub use assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; 82pub use assists::{Assist, AssistConfig, AssistId, AssistKind};
83pub use completion::{ 83pub use completion::{
84 CompletionConfig, CompletionItem, CompletionItemKind, CompletionResolveCapability, 84 CompletionConfig, CompletionItem, CompletionItemKind, CompletionResolveCapability,
85 CompletionScore, ImportEdit, InsertTextFormat, 85 CompletionScore, ImportEdit, InsertTextFormat,
@@ -491,22 +491,16 @@ impl Analysis {
491 } 491 }
492 492
493 /// Computes assists (aka code actions aka intentions) for the given 493 /// Computes assists (aka code actions aka intentions) for the given
494 /// position. Computes enough info to show the lightbulb list in the editor, 494 /// position. If `resolve == false`, computes enough info to show the
495 /// but doesn't compute actual edits, to improve performance. 495 /// lightbulb list in the editor, but doesn't compute actual edits, to
496 /// 496 /// improve performance.
497 /// When the user clicks on the assist, call `resolve_assists` to get the 497 pub fn assists(
498 /// edit.
499 pub fn assists(&self, config: &AssistConfig, frange: FileRange) -> Cancelable<Vec<Assist>> {
500 self.with_db(|db| Assist::unresolved(db, config, frange))
501 }
502
503 /// Computes resolved assists with source changes for the given position.
504 pub fn resolve_assists(
505 &self, 498 &self,
506 config: &AssistConfig, 499 config: &AssistConfig,
500 resolve: bool,
507 frange: FileRange, 501 frange: FileRange,
508 ) -> Cancelable<Vec<ResolvedAssist>> { 502 ) -> Cancelable<Vec<Assist>> {
509 self.with_db(|db| assists::Assist::resolved(db, config, frange)) 503 self.with_db(|db| Assist::get(db, config, resolve, frange))
510 } 504 }
511 505
512 /// Computes the set of diagnostics for the given file. 506 /// Computes the set of diagnostics for the given file.