aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-18 15:22:01 +0100
committerAleksey Kladov <[email protected]>2020-08-18 15:22:01 +0100
commiteb81731600d1bc50efc00e32b9fc2244a2af52ad (patch)
treea19bf046c3952221c5a58a077d8a2fdd82fc8d0c /crates/ide/src/lib.rs
parent0866b1be894b9148cf69897a1e1aa70e3c416e29 (diff)
Minor
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r--crates/ide/src/lib.rs31
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
100pub type Cancelable<T> = Result<T, Canceled>; 100pub type Cancelable<T> = Result<T, Canceled>;
101 101
102#[derive(Debug)]
103pub 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)]
112pub 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
119impl 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)]
133pub struct RangeInfo<T> { 104pub struct RangeInfo<T> {