mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
fill struct fields diagnostic
This commit is contained in:
parent
32db5884ad
commit
26ed925685
9 changed files with 269 additions and 18 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue