diff options
-rw-r--r-- | crates/ra_hir/src/resolve.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 24 |
3 files changed, 18 insertions, 16 deletions
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index 0f866e6c2..ce80be17f 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs | |||
@@ -14,12 +14,8 @@ use crate::{ | |||
14 | generics::GenericParams, | 14 | generics::GenericParams, |
15 | expr::{scope::{ExprScopes, ScopeId}, PatId}, | 15 | expr::{scope::{ExprScopes, ScopeId}, PatId}, |
16 | impl_block::ImplBlock, | 16 | impl_block::ImplBlock, |
17 | <<<<<<< HEAD | ||
18 | path::Path, | 17 | path::Path, |
19 | Trait | 18 | Trait |
20 | ======= | ||
21 | path::Path, Trait, | ||
22 | >>>>>>> complete_import: add new import resolver infrastructure with some hardcoded importable name. | ||
23 | }; | 19 | }; |
24 | 20 | ||
25 | #[derive(Debug, Clone, Default)] | 21 | #[derive(Debug, Clone, Default)] |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index a6f0ab289..42399622a 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -19,11 +19,7 @@ use ra_syntax::{ | |||
19 | 19 | ||
20 | use crate::{ | 20 | use crate::{ |
21 | HirDatabase, Function, Struct, Enum, Const, Static, Either, DefWithBody, PerNs, Name, | 21 | HirDatabase, Function, Struct, Enum, Const, Static, Either, DefWithBody, PerNs, Name, |
22 | <<<<<<< HEAD | 22 | AsName, Module, HirFileId, Crate, Trait, Resolver, Ty, ImportResolver, |
23 | AsName, Module, HirFileId, Crate, Trait, Resolver, Ty, | ||
24 | ======= | ||
25 | AsName, Module, HirFileId, Crate, Trait, Resolver, ImportResolver, | ||
26 | >>>>>>> complete_import: add new import resolver infrastructure with some hardcoded importable name. | ||
27 | expr::{BodySourceMap, scope::{ScopeId, ExprScopes}}, | 23 | expr::{BodySourceMap, scope::{ScopeId, ExprScopes}}, |
28 | ids::LocationCtx, | 24 | ids::LocationCtx, |
29 | expr, AstId, | 25 | expr, AstId, |
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 63d475823..5bd5376c9 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -23,13 +23,23 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | |||
23 | ); | 23 | ); |
24 | builder.finish() | 24 | builder.finish() |
25 | }; | 25 | }; |
26 | CompletionItem::new( | 26 | |
27 | CompletionKind::Reference, | 27 | // Hack: copied this check form conv.rs beacause auto import can produce edits |
28 | ctx.source_range(), | 28 | // that invalidate assert in conv_with. |
29 | build_import_label(&name, &path), | 29 | if edit |
30 | ) | 30 | .as_atoms() |
31 | .text_edit(edit) | 31 | .iter() |
32 | .add_to(acc) | 32 | .filter(|atom| !ctx.source_range().is_subrange(&atom.delete)) |
33 | .all(|atom| ctx.source_range().intersection(&atom.delete).is_none()) | ||
34 | { | ||
35 | CompletionItem::new( | ||
36 | CompletionKind::Reference, | ||
37 | ctx.source_range(), | ||
38 | build_import_label(&name, &path), | ||
39 | ) | ||
40 | .text_edit(edit) | ||
41 | .add_to(acc); | ||
42 | } | ||
33 | }); | 43 | }); |
34 | } | 44 | } |
35 | } | 45 | } |