aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs4
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs10
2 files changed, 9 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index c1f48b026..cb70a1f21 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -1,4 +1,4 @@
1use ra_assists::auto_import; 1use ra_assists::auto_import_text_edit;
2use ra_syntax::{ast, AstNode, SmolStr}; 2use ra_syntax::{ast, AstNode, SmolStr};
3use ra_text_edit::TextEditBuilder; 3use ra_text_edit::TextEditBuilder;
4use rustc_hash::FxHashMap; 4use rustc_hash::FxHashMap;
@@ -23,7 +23,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
23 let edit = { 23 let edit = {
24 let mut builder = TextEditBuilder::default(); 24 let mut builder = TextEditBuilder::default();
25 builder.replace(ctx.source_range(), name.to_string()); 25 builder.replace(ctx.source_range(), name.to_string());
26 auto_import::auto_import_text_edit( 26 auto_import_text_edit(
27 &ctx.token.parent(), 27 &ctx.token.parent(),
28 &ctx.token.parent(), 28 &ctx.token.parent(),
29 &path, 29 &path,
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs
index 93e1e7c2d..f07061e99 100644
--- a/crates/ra_ide_api/src/diagnostics.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -2,11 +2,11 @@ use std::cell::RefCell;
2 2
3use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; 3use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink};
4use itertools::Itertools; 4use itertools::Itertools;
5use ra_assists::ast_editor::{AstBuilder, AstEditor}; 5use ra_assists::{ast_builder::Make, ast_editor::AstEditor};
6use ra_db::SourceDatabase; 6use ra_db::SourceDatabase;
7use ra_prof::profile; 7use ra_prof::profile;
8use ra_syntax::{ 8use ra_syntax::{
9 ast::{self, AstNode, RecordField}, 9 ast::{self, AstNode},
10 Location, SyntaxNode, TextRange, T, 10 Location, SyntaxNode, TextRange, T,
11}; 11};
12use ra_text_edit::{TextEdit, TextEditBuilder}; 12use ra_text_edit::{TextEdit, TextEditBuilder};
@@ -59,7 +59,11 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
59 let node = d.ast(db); 59 let node = d.ast(db);
60 let mut ast_editor = AstEditor::new(node); 60 let mut ast_editor = AstEditor::new(node);
61 for f in d.missed_fields.iter() { 61 for f in d.missed_fields.iter() {
62 ast_editor.append_field(&AstBuilder::<RecordField>::from_name(f)); 62 let field = Make::<ast::RecordField>::from(
63 Make::<ast::NameRef>::from(&f.to_string()),
64 Some(Make::<ast::Expr>::unit()),
65 );
66 ast_editor.append_field(&field);
63 } 67 }
64 68
65 let mut builder = TextEditBuilder::default(); 69 let mut builder = TextEditBuilder::default();