diff options
author | Sergey Parilin <[email protected]> | 2019-04-10 22:00:56 +0100 |
---|---|---|
committer | Sergey Parilin <[email protected]> | 2019-05-06 15:16:11 +0100 |
commit | 26ed92568596ce45ad96c3e2ea5d54099702537f (patch) | |
tree | 29624826736c7287ac7dea635e639f20280d2533 /crates/ra_hir/src/diagnostics.rs | |
parent | 32db5884ada59c72aa7ab9f88910ef7c8f882e7d (diff) |
fill struct fields diagnostic
Diffstat (limited to 'crates/ra_hir/src/diagnostics.rs')
-rw-r--r-- | crates/ra_hir/src/diagnostics.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs index d6a51b833..61cd9d6b1 100644 --- a/crates/ra_hir/src/diagnostics.rs +++ b/crates/ra_hir/src/diagnostics.rs | |||
@@ -3,7 +3,7 @@ use std::{fmt, any::Any}; | |||
3 | use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode}; | 3 | use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode}; |
4 | use relative_path::RelativePathBuf; | 4 | use relative_path::RelativePathBuf; |
5 | 5 | ||
6 | use crate::{HirFileId, HirDatabase}; | 6 | use crate::{HirFileId, HirDatabase, Name}; |
7 | 7 | ||
8 | /// Diagnostic defines hir API for errors and warnings. | 8 | /// Diagnostic defines hir API for errors and warnings. |
9 | /// | 9 | /// |
@@ -113,3 +113,25 @@ impl Diagnostic for UnresolvedModule { | |||
113 | self | 113 | self |
114 | } | 114 | } |
115 | } | 115 | } |
116 | |||
117 | #[derive(Debug)] | ||
118 | pub struct MissingFields { | ||
119 | pub file: HirFileId, | ||
120 | pub field_list: AstPtr<ast::NamedFieldList>, | ||
121 | pub missed_fields: Vec<Name>, | ||
122 | } | ||
123 | |||
124 | impl Diagnostic for MissingFields { | ||
125 | fn message(&self) -> String { | ||
126 | "fill structure fields".to_string() | ||
127 | } | ||
128 | fn file(&self) -> HirFileId { | ||
129 | self.file | ||
130 | } | ||
131 | fn syntax_node_ptr(&self) -> SyntaxNodePtr { | ||
132 | self.field_list.into() | ||
133 | } | ||
134 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
135 | self | ||
136 | } | ||
137 | } | ||