From 26ed92568596ce45ad96c3e2ea5d54099702537f Mon Sep 17 00:00:00 2001 From: Sergey Parilin Date: Thu, 11 Apr 2019 00:00:56 +0300 Subject: fill struct fields diagnostic --- crates/ra_assists/src/ast_editor.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index 6854294ae..726e5c0a3 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs @@ -4,6 +4,7 @@ use arrayvec::ArrayVec; use ra_text_edit::TextEditBuilder; use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction}; use ra_fmt::leading_indent; +use hir::Name; pub struct AstEditor { original_ast: TreeArc, @@ -235,6 +236,10 @@ pub struct AstBuilder { } impl AstBuilder { + pub fn from_name(name: &Name) -> TreeArc { + ast_node_from_file_text(&format!("fn f() {{ S {{ {}: (), }} }}", name)) + } + fn from_text(text: &str) -> TreeArc { ast_node_from_file_text(&format!("fn f() {{ S {{ {}, }} }}", text)) } -- cgit v1.2.3