Skip to content

Commit 4f3ce62

Browse files
bors[bot]Veykril
andauthored
Merge #10402
10402: fix: Don't show flyimport completions in use renames r=Veykril a=Veykril Fixes #10367 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 529b7a4 + d7d16a7 commit 4f3ce62

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

crates/ide_completion/src/completions/flyimport.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,4 +1220,17 @@ fn function() {
12201220
"#]],
12211221
);
12221222
}
1223+
1224+
#[test]
1225+
fn flyimport_rename() {
1226+
check(
1227+
r#"
1228+
mod module {
1229+
pub struct Struct;
1230+
}
1231+
use self as Str$0;
1232+
"#,
1233+
expect![[r#""#]],
1234+
);
1235+
}
12231236
}

crates/ide_completion/src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ impl<'a> CompletionContext<'a> {
383383
| ImmediateLocation::ModDeclaration(_)
384384
| ImmediateLocation::RecordPat(_)
385385
| ImmediateLocation::RecordExpr(_)
386+
| ImmediateLocation::Rename
386387
)
387388
)
388389
}

crates/ide_completion/src/patterns.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub(crate) enum ImmediatePrevSibling {
3232
pub(crate) enum ImmediateLocation {
3333
Use,
3434
UseTree,
35+
Rename,
3536
Impl,
3637
Trait,
3738
RecordField,
@@ -201,6 +202,7 @@ pub(crate) fn determine_location(
201202
ast::Use(_it) => ImmediateLocation::Use,
202203
ast::UseTree(_it) => ImmediateLocation::UseTree,
203204
ast::UseTreeList(_it) => ImmediateLocation::UseTree,
205+
ast::Rename(_it) => ImmediateLocation::Rename,
204206
ast::StmtList(_it) => ImmediateLocation::StmtList,
205207
ast::SourceFile(_it) => ImmediateLocation::ItemList,
206208
ast::ItemList(_it) => ImmediateLocation::ItemList,

0 commit comments

Comments
 (0)