diff options
author | vsrs <[email protected]> | 2020-05-08 17:34:34 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-05-08 17:34:34 +0100 |
commit | 0ef17ef1ee9fb0ce7149176d12f4d225f6d01401 (patch) | |
tree | fa2f168120f36f8dbef5dc1e85fea0c0071639c2 /crates/ra_ide/src/lib.rs | |
parent | 1be6320ea6cf7830195f80681fa0f43cc340da7e (diff) | |
parent | d3eb9d8eafbebca7da95fa8a4813b92eb5080500 (diff) |
Merge remote-tracking branch 'upstream/master' into uniformed_debug_lens
# Conflicts:
# editors/code/src/commands/runnables.ts
Diffstat (limited to 'crates/ra_ide/src/lib.rs')
-rw-r--r-- | crates/ra_ide/src/lib.rs | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 4ed02f60e..915199bd8 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -31,7 +31,6 @@ mod syntax_highlighting; | |||
31 | mod parent_module; | 31 | mod parent_module; |
32 | mod references; | 32 | mod references; |
33 | mod impls; | 33 | mod impls; |
34 | mod assists; | ||
35 | mod diagnostics; | 34 | mod diagnostics; |
36 | mod syntax_tree; | 35 | mod syntax_tree; |
37 | mod folding_ranges; | 36 | mod folding_ranges; |
@@ -64,7 +63,6 @@ use ra_syntax::{SourceFile, TextRange, TextSize}; | |||
64 | use crate::display::ToNav; | 63 | use crate::display::ToNav; |
65 | 64 | ||
66 | pub use crate::{ | 65 | pub use crate::{ |
67 | assists::{Assist, AssistId}, | ||
68 | call_hierarchy::CallItem, | 66 | call_hierarchy::CallItem, |
69 | completion::{ | 67 | completion::{ |
70 | CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, | 68 | CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, |
@@ -84,6 +82,7 @@ pub use crate::{ | |||
84 | }; | 82 | }; |
85 | 83 | ||
86 | pub use hir::Documentation; | 84 | pub use hir::Documentation; |
85 | pub use ra_assists::AssistId; | ||
87 | pub use ra_db::{ | 86 | pub use ra_db::{ |
88 | Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, | 87 | Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, |
89 | }; | 88 | }; |
@@ -134,10 +133,12 @@ pub struct AnalysisHost { | |||
134 | db: RootDatabase, | 133 | db: RootDatabase, |
135 | } | 134 | } |
136 | 135 | ||
137 | impl Default for AnalysisHost { | 136 | #[derive(Debug)] |
138 | fn default() -> AnalysisHost { | 137 | pub struct Assist { |
139 | AnalysisHost::new(None) | 138 | pub id: AssistId, |
140 | } | 139 | pub label: String, |
140 | pub group_label: Option<String>, | ||
141 | pub source_change: SourceChange, | ||
141 | } | 142 | } |
142 | 143 | ||
143 | impl AnalysisHost { | 144 | impl AnalysisHost { |
@@ -187,6 +188,12 @@ impl AnalysisHost { | |||
187 | } | 188 | } |
188 | } | 189 | } |
189 | 190 | ||
191 | impl Default for AnalysisHost { | ||
192 | fn default() -> AnalysisHost { | ||
193 | AnalysisHost::new(None) | ||
194 | } | ||
195 | } | ||
196 | |||
190 | /// Analysis is a snapshot of a world state at a moment in time. It is the main | 197 | /// Analysis is a snapshot of a world state at a moment in time. It is the main |
191 | /// entry point for asking semantic information about the world. When the world | 198 | /// entry point for asking semantic information about the world. When the world |
192 | /// state is advanced using `AnalysisHost::apply_change` method, all existing | 199 | /// state is advanced using `AnalysisHost::apply_change` method, all existing |
@@ -464,7 +471,17 @@ impl Analysis { | |||
464 | /// Computes assists (aka code actions aka intentions) for the given | 471 | /// Computes assists (aka code actions aka intentions) for the given |
465 | /// position. | 472 | /// position. |
466 | pub fn assists(&self, frange: FileRange) -> Cancelable<Vec<Assist>> { | 473 | pub fn assists(&self, frange: FileRange) -> Cancelable<Vec<Assist>> { |
467 | self.with_db(|db| assists::assists(db, frange)) | 474 | self.with_db(|db| { |
475 | ra_assists::Assist::resolved(db, frange) | ||
476 | .into_iter() | ||
477 | .map(|assist| Assist { | ||
478 | id: assist.assist.id, | ||
479 | label: assist.assist.label, | ||
480 | group_label: assist.assist.group.map(|it| it.0), | ||
481 | source_change: assist.source_change, | ||
482 | }) | ||
483 | .collect() | ||
484 | }) | ||
468 | } | 485 | } |
469 | 486 | ||
470 | /// Computes the set of diagnostics for the given file. | 487 | /// Computes the set of diagnostics for the given file. |