diff options
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/diagnostics.rs | 13 | ||||
-rw-r--r-- | crates/ide/src/lib.rs | 1 |
2 files changed, 5 insertions, 9 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 1f85805d2..3c36c0e15 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs | |||
@@ -19,7 +19,7 @@ use syntax::{ | |||
19 | }; | 19 | }; |
20 | use text_edit::TextEdit; | 20 | use text_edit::TextEdit; |
21 | 21 | ||
22 | use crate::{FileId, SourceChange, SourceFileEdit}; | 22 | use crate::{FileId, Label, SourceChange, SourceFileEdit}; |
23 | 23 | ||
24 | use self::fixes::DiagnosticWithFix; | 24 | use self::fixes::DiagnosticWithFix; |
25 | 25 | ||
@@ -34,20 +34,15 @@ pub struct Diagnostic { | |||
34 | 34 | ||
35 | #[derive(Debug)] | 35 | #[derive(Debug)] |
36 | pub struct Fix { | 36 | pub struct Fix { |
37 | pub label: String, | 37 | pub label: Label, |
38 | pub source_change: SourceChange, | 38 | pub source_change: SourceChange, |
39 | /// Allows to trigger the fix only when the caret is in the range given | 39 | /// Allows to trigger the fix only when the caret is in the range given |
40 | pub fix_trigger_range: TextRange, | 40 | pub fix_trigger_range: TextRange, |
41 | } | 41 | } |
42 | 42 | ||
43 | impl Fix { | 43 | impl Fix { |
44 | fn new( | 44 | fn new(label: &str, source_change: SourceChange, fix_trigger_range: TextRange) -> Self { |
45 | label: impl Into<String>, | 45 | let label = Label::new(label); |
46 | source_change: SourceChange, | ||
47 | fix_trigger_range: TextRange, | ||
48 | ) -> Self { | ||
49 | let label = label.into(); | ||
50 | assert!(label.starts_with(char::is_uppercase) && !label.ends_with('.')); | ||
51 | Self { label, source_change, fix_trigger_range } | 46 | Self { label, source_change, fix_trigger_range } |
52 | } | 47 | } |
53 | } | 48 | } |
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index f37119e28..e3af6d5bc 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -88,6 +88,7 @@ pub use base_db::{ | |||
88 | pub use hir::{Documentation, Semantics}; | 88 | pub use hir::{Documentation, Semantics}; |
89 | pub use ide_db::{ | 89 | pub use ide_db::{ |
90 | change::AnalysisChange, | 90 | change::AnalysisChange, |
91 | label::Label, | ||
91 | line_index::{LineCol, LineIndex}, | 92 | line_index::{LineCol, LineIndex}, |
92 | search::SearchScope, | 93 | search::SearchScope, |
93 | source_change::{FileSystemEdit, SourceChange, SourceFileEdit}, | 94 | source_change::{FileSystemEdit, SourceChange, SourceFileEdit}, |