aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/diagnostics.rs13
-rw-r--r--crates/ide/src/lib.rs1
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};
20use text_edit::TextEdit; 20use text_edit::TextEdit;
21 21
22use crate::{FileId, SourceChange, SourceFileEdit}; 22use crate::{FileId, Label, SourceChange, SourceFileEdit};
23 23
24use self::fixes::DiagnosticWithFix; 24use self::fixes::DiagnosticWithFix;
25 25
@@ -34,20 +34,15 @@ pub struct Diagnostic {
34 34
35#[derive(Debug)] 35#[derive(Debug)]
36pub struct Fix { 36pub 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
43impl Fix { 43impl 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::{
88pub use hir::{Documentation, Semantics}; 88pub use hir::{Documentation, Semantics};
89pub use ide_db::{ 89pub 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},