mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
always produce source for import
This commit is contained in:
parent
0a758a2c48
commit
0de89f786f
6 changed files with 70 additions and 29 deletions
|
@ -19,11 +19,14 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
for (name, res) in module_scope.entries() {
|
||||
if Some(module) == ctx.module {
|
||||
if let Some(import) = res.import {
|
||||
let path = module.import_source(ctx.db, import);
|
||||
if path.syntax().range().contains_inclusive(ctx.offset) {
|
||||
// for `use self::foo<|>`, don't suggest `foo` as a completion
|
||||
tested_by!(dont_complete_current_use);
|
||||
continue;
|
||||
if let hir::ImportSource::UseTree(tree) =
|
||||
module.import_source(ctx.db, import)
|
||||
{
|
||||
if tree.syntax().range().contains_inclusive(ctx.offset) {
|
||||
// for `use self::foo<|>`, don't suggest `foo` as a completion
|
||||
tested_by!(dont_complete_current_use);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue