diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_expand/src/diagnostics.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_hir_expand/src/diagnostics.rs b/crates/ra_hir_expand/src/diagnostics.rs index e58defa68..cc7dc3af2 100644 --- a/crates/ra_hir_expand/src/diagnostics.rs +++ b/crates/ra_hir_expand/src/diagnostics.rs | |||
@@ -22,6 +22,7 @@ use crate::InFile; | |||
22 | 22 | ||
23 | pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static { | 23 | pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static { |
24 | fn message(&self) -> String; | 24 | fn message(&self) -> String; |
25 | /// A presentation source of the diagnostics, to use in highlighting and similar actions | ||
25 | fn presentation(&self) -> InFile<SyntaxNodePtr>; | 26 | fn presentation(&self) -> InFile<SyntaxNodePtr>; |
26 | fn as_any(&self) -> &(dyn Any + Send + 'static); | 27 | fn as_any(&self) -> &(dyn Any + Send + 'static); |
27 | fn is_experimental(&self) -> bool { | 28 | fn is_experimental(&self) -> bool { |
diff --git a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs index 56d454ac6..1955e1521 100644 --- a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs +++ b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs | |||
@@ -1,3 +1,4 @@ | |||
1 | //! Provides a way to derive fixes based on the diagnostic data. | ||
1 | use crate::Fix; | 2 | use crate::Fix; |
2 | use ast::{edit::IndentLevel, make}; | 3 | use ast::{edit::IndentLevel, make}; |
3 | use hir::{ | 4 | use hir::{ |
@@ -13,8 +14,9 @@ use ra_ide_db::{ | |||
13 | use ra_syntax::{algo, ast, AstNode, TextRange}; | 14 | use ra_syntax::{algo, ast, AstNode, TextRange}; |
14 | use ra_text_edit::{TextEdit, TextEditBuilder}; | 15 | use ra_text_edit::{TextEdit, TextEditBuilder}; |
15 | 16 | ||
16 | // TODO kb | 17 | /// A trait to implement fot the Diagnostic that has a fix available. |
17 | pub trait DiagnosticWithFix { | 18 | pub trait DiagnosticWithFix { |
19 | /// Provides a fix with the fix range, if applicable in the current semantics. | ||
18 | fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<(Fix, TextRange)>; | 20 | fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<(Fix, TextRange)>; |
19 | } | 21 | } |
20 | 22 | ||