aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorSergey Parilin <[email protected]>2019-04-10 22:00:56 +0100
committerSergey Parilin <[email protected]>2019-05-06 15:16:11 +0100
commit26ed92568596ce45ad96c3e2ea5d54099702537f (patch)
tree29624826736c7287ac7dea635e639f20280d2533 /crates/ra_assists/src
parent32db5884ada59c72aa7ab9f88910ef7c8f882e7d (diff)
fill struct fields diagnostic
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/ast_editor.rs5
1 files changed, 5 insertions, 0 deletions
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;
4use ra_text_edit::TextEditBuilder; 4use ra_text_edit::TextEditBuilder;
5use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction}; 5use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction};
6use ra_fmt::leading_indent; 6use ra_fmt::leading_indent;
7use hir::Name;
7 8
8pub struct AstEditor<N: AstNode> { 9pub struct AstEditor<N: AstNode> {
9 original_ast: TreeArc<N>, 10 original_ast: TreeArc<N>,
@@ -235,6 +236,10 @@ pub struct AstBuilder<N: AstNode> {
235} 236}
236 237
237impl AstBuilder<ast::NamedField> { 238impl AstBuilder<ast::NamedField> {
239 pub fn from_name(name: &Name) -> TreeArc<ast::NamedField> {
240 ast_node_from_file_text(&format!("fn f() {{ S {{ {}: (), }} }}", name))
241 }
242
238 fn from_text(text: &str) -> TreeArc<ast::NamedField> { 243 fn from_text(text: &str) -> TreeArc<ast::NamedField> {
239 ast_node_from_file_text(&format!("fn f() {{ S {{ {}, }} }}", text)) 244 ast_node_from_file_text(&format!("fn f() {{ S {{ {}, }} }}", text))
240 } 245 }