diff options
Diffstat (limited to 'crates/ra_ide/src/completion/complete_dot.rs')
-rw-r--r-- | crates/ra_ide/src/completion/complete_dot.rs | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index 174b39964..c16357a7e 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs | |||
@@ -1,16 +1,11 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::{ | 3 | use hir::{HasVisibility, Type}; |
4 | HasVisibility, | ||
5 | // HirDisplay, | ||
6 | Type, | ||
7 | }; | ||
8 | 4 | ||
9 | use crate::{ | 5 | use crate::{ |
10 | call_info::call_info, | ||
11 | completion::{ | 6 | completion::{ |
12 | completion_context::CompletionContext, | 7 | completion_context::CompletionContext, |
13 | completion_item::{CompletionKind, Completions, ScoreOption}, | 8 | completion_item::{CompletionKind, Completions}, |
14 | }, | 9 | }, |
15 | // CallInfo, | 10 | // CallInfo, |
16 | CompletionItem, | 11 | CompletionItem, |
@@ -46,15 +41,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) { | |||
46 | 41 | ||
47 | fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: &Type) { | 42 | fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: &Type) { |
48 | for receiver in receiver.autoderef(ctx.db) { | 43 | for receiver in receiver.autoderef(ctx.db) { |
49 | let fields = receiver.fields(ctx.db); | 44 | for (field, ty) in receiver.fields(ctx.db) { |
50 | |||
51 | if let Some(record_field) = &ctx.record_field_syntax { | ||
52 | acc.with_score_option(ScoreOption::RecordField(record_field.clone())); | ||
53 | } else if let Some(call_info) = call_info(ctx.db, ctx.file_position) { | ||
54 | acc.with_score_option(ScoreOption::CallFn(call_info)); | ||
55 | } | ||
56 | |||
57 | for (field, ty) in fields { | ||
58 | if ctx.scope().module().map_or(false, |m| !field.is_visible_from(ctx.db, m)) { | 45 | if ctx.scope().module().map_or(false, |m| !field.is_visible_from(ctx.db, m)) { |
59 | // Skip private field. FIXME: If the definition location of the | 46 | // Skip private field. FIXME: If the definition location of the |
60 | // field is editable, we should show the completion | 47 | // field is editable, we should show the completion |