diff options
author | Aleksey Kladov <[email protected]> | 2020-08-18 15:22:01 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-18 15:22:01 +0100 |
commit | eb81731600d1bc50efc00e32b9fc2244a2af52ad (patch) | |
tree | a19bf046c3952221c5a58a077d8a2fdd82fc8d0c /crates/ide/src/lib.rs | |
parent | 0866b1be894b9148cf69897a1e1aa70e3c416e29 (diff) |
Minor
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r-- | crates/ide/src/lib.rs | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 2a73abba2..f37119e28 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -65,7 +65,7 @@ pub use crate::{ | |||
65 | completion::{ | 65 | completion::{ |
66 | CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, | 66 | CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, |
67 | }, | 67 | }, |
68 | diagnostics::{DiagnosticsConfig, Severity}, | 68 | diagnostics::{Diagnostic, DiagnosticsConfig, Fix, Severity}, |
69 | display::NavigationTarget, | 69 | display::NavigationTarget, |
70 | expand_macro::ExpandedMacro, | 70 | expand_macro::ExpandedMacro, |
71 | file_structure::StructureNode, | 71 | file_structure::StructureNode, |
@@ -99,35 +99,6 @@ pub use text_edit::{Indel, TextEdit}; | |||
99 | 99 | ||
100 | pub type Cancelable<T> = Result<T, Canceled>; | 100 | pub type Cancelable<T> = Result<T, Canceled>; |
101 | 101 | ||
102 | #[derive(Debug)] | ||
103 | pub struct Diagnostic { | ||
104 | pub name: Option<String>, | ||
105 | pub message: String, | ||
106 | pub range: TextRange, | ||
107 | pub severity: Severity, | ||
108 | pub fix: Option<Fix>, | ||
109 | } | ||
110 | |||
111 | #[derive(Debug)] | ||
112 | pub struct Fix { | ||
113 | pub label: String, | ||
114 | pub source_change: SourceChange, | ||
115 | /// Allows to trigger the fix only when the caret is in the range given | ||
116 | pub fix_trigger_range: TextRange, | ||
117 | } | ||
118 | |||
119 | impl Fix { | ||
120 | pub fn new( | ||
121 | label: impl Into<String>, | ||
122 | source_change: SourceChange, | ||
123 | fix_trigger_range: TextRange, | ||
124 | ) -> Self { | ||
125 | let label = label.into(); | ||
126 | assert!(label.starts_with(char::is_uppercase) && !label.ends_with('.')); | ||
127 | Self { label, source_change, fix_trigger_range } | ||
128 | } | ||
129 | } | ||
130 | |||
131 | /// Info associated with a text range. | 102 | /// Info associated with a text range. |
132 | #[derive(Debug)] | 103 | #[derive(Debug)] |
133 | pub struct RangeInfo<T> { | 104 | pub struct RangeInfo<T> { |