Don't show flyimport completions in use renames

This commit is contained in:
Lukas Wirth 2021-09-30 18:15:55 +02:00
parent 533ca584c3
commit d7d16a7ac9
3 changed files with 16 additions and 0 deletions

View File

@ -1220,4 +1220,17 @@ fn function() {
"#]],
);
}
#[test]
fn flyimport_rename() {
check(
r#"
mod module {
pub struct Struct;
}
use self as Str$0;
"#,
expect![[r#""#]],
);
}
}

View File

@ -383,6 +383,7 @@ pub(crate) fn is_path_disallowed(&self) -> bool {
| ImmediateLocation::ModDeclaration(_)
| ImmediateLocation::RecordPat(_)
| ImmediateLocation::RecordExpr(_)
| ImmediateLocation::Rename
)
)
}

View File

@ -32,6 +32,7 @@ pub(crate) enum ImmediatePrevSibling {
pub(crate) enum ImmediateLocation {
Use,
UseTree,
Rename,
Impl,
Trait,
RecordField,
@ -201,6 +202,7 @@ pub(crate) fn determine_location(
ast::Use(_it) => ImmediateLocation::Use,
ast::UseTree(_it) => ImmediateLocation::UseTree,
ast::UseTreeList(_it) => ImmediateLocation::UseTree,
ast::Rename(_it) => ImmediateLocation::Rename,
ast::StmtList(_it) => ImmediateLocation::StmtList,
ast::SourceFile(_it) => ImmediateLocation::ItemList,
ast::ItemList(_it) => ImmediateLocation::ItemList,