diff options
author | Aleksey Kladov <[email protected]> | 2020-05-06 14:26:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-06 14:43:47 +0100 |
commit | fdd4df97ba5ce1f59abf9e945052fc6f3e077c3a (patch) | |
tree | 44ebb47b92d71a5e30cb469988ff1b490ca856d8 /crates/ra_assists/src/lib.rs | |
parent | 1116c9a0e9992d0dea8dac87de95c8a74c093cff (diff) |
Use SourceChange for assists
Diffstat (limited to 'crates/ra_assists/src/lib.rs')
-rw-r--r-- | crates/ra_assists/src/lib.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index f4f37614f..8cd8f89c4 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -19,9 +19,8 @@ pub mod ast_transform; | |||
19 | 19 | ||
20 | use hir::Semantics; | 20 | use hir::Semantics; |
21 | use ra_db::{FileId, FileRange}; | 21 | use ra_db::{FileId, FileRange}; |
22 | use ra_ide_db::RootDatabase; | 22 | use ra_ide_db::{source_change::SourceChange, RootDatabase}; |
23 | use ra_syntax::{TextRange, TextSize}; | 23 | use ra_syntax::TextRange; |
24 | use ra_text_edit::TextEdit; | ||
25 | 24 | ||
26 | pub(crate) use crate::assist_ctx::{Assist, AssistCtx}; | 25 | pub(crate) use crate::assist_ctx::{Assist, AssistCtx}; |
27 | 26 | ||
@@ -58,20 +57,13 @@ impl AssistLabel { | |||
58 | } | 57 | } |
59 | 58 | ||
60 | #[derive(Debug, Clone)] | 59 | #[derive(Debug, Clone)] |
61 | pub struct AssistAction { | ||
62 | pub edit: TextEdit, | ||
63 | pub cursor_position: Option<TextSize>, | ||
64 | pub file: AssistFile, | ||
65 | } | ||
66 | |||
67 | #[derive(Debug, Clone)] | ||
68 | pub struct ResolvedAssist { | 60 | pub struct ResolvedAssist { |
69 | pub label: AssistLabel, | 61 | pub label: AssistLabel, |
70 | pub action: AssistAction, | 62 | pub action: SourceChange, |
71 | } | 63 | } |
72 | 64 | ||
73 | #[derive(Debug, Clone, Copy)] | 65 | #[derive(Debug, Clone, Copy)] |
74 | pub enum AssistFile { | 66 | enum AssistFile { |
75 | CurrentFile, | 67 | CurrentFile, |
76 | TargetFile(FileId), | 68 | TargetFile(FileId), |
77 | } | 69 | } |