fill struct fields diagnostic

This commit is contained in:
Sergey Parilin 2019-04-11 00:00:56 +03:00 committed by Sergey Parilin
parent 32db5884ad
commit 26ed925685
9 changed files with 269 additions and 18 deletions

View file

@ -3,7 +3,7 @@ use std::{fmt, any::Any};
use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode};
use relative_path::RelativePathBuf;
use crate::{HirFileId, HirDatabase};
use crate::{HirFileId, HirDatabase, Name};
/// Diagnostic defines hir API for errors and warnings.
///
@ -113,3 +113,25 @@ impl Diagnostic for UnresolvedModule {
self
}
}
#[derive(Debug)]
pub struct MissingFields {
pub file: HirFileId,
pub field_list: AstPtr<ast::NamedFieldList>,
pub missed_fields: Vec<Name>,
}
impl Diagnostic for MissingFields {
fn message(&self) -> String {
"fill structure fields".to_string()
}
fn file(&self) -> HirFileId {
self.file
}
fn syntax_node_ptr(&self) -> SyntaxNodePtr {
self.field_list.into()
}
fn as_any(&self) -> &(dyn Any + Send + 'static) {
self
}
}