diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-06 15:27:34 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-06 15:27:34 +0100 |
commit | ef782adc293deb287128f005dbab2038ba3ccdc1 (patch) | |
tree | 6e451b71b482e75a5a30548ab8f769c5ec17864c /crates/ra_assists/src/ast_editor.rs | |
parent | 32db5884ada59c72aa7ab9f88910ef7c8f882e7d (diff) | |
parent | 12f8472d2800b2d7c05cb1fc466c80072ed8e283 (diff) |
Merge #1163
1163: fill struct fields diagnostic r=matklad a=pasa
implementation of #1095
Co-authored-by: Sergey Parilin <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/ast_editor.rs')
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 5 |
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; | |||
4 | use ra_text_edit::TextEditBuilder; | 4 | use ra_text_edit::TextEditBuilder; |
5 | use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction}; | 5 | use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction}; |
6 | use ra_fmt::leading_indent; | 6 | use ra_fmt::leading_indent; |
7 | use hir::Name; | ||
7 | 8 | ||
8 | pub struct AstEditor<N: AstNode> { | 9 | pub 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 | ||
237 | impl AstBuilder<ast::NamedField> { | 238 | impl 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 | } |