mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Refine self
, super
and crate
completion in use paths
This commit is contained in:
parent
e14f5cfff0
commit
2225db2eb4
9 changed files with 47 additions and 54 deletions
|
@ -27,6 +27,7 @@ pub(crate) enum ImmediatePrevSibling {
|
|||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum ImmediateLocation {
|
||||
Use,
|
||||
UseTree,
|
||||
Impl,
|
||||
Trait,
|
||||
RecordField,
|
||||
|
@ -180,6 +181,8 @@ pub(crate) fn determine_location(
|
|||
match parent {
|
||||
ast::IdentPat(_it) => ImmediateLocation::IdentPat,
|
||||
ast::Use(_it) => ImmediateLocation::Use,
|
||||
ast::UseTree(_it) => ImmediateLocation::UseTree,
|
||||
ast::UseTreeList(_it) => ImmediateLocation::UseTree,
|
||||
ast::BlockExpr(_it) => ImmediateLocation::BlockExpr,
|
||||
ast::SourceFile(_it) => ImmediateLocation::ItemList,
|
||||
ast::ItemList(_it) => ImmediateLocation::ItemList,
|
||||
|
@ -373,8 +376,8 @@ mod tests {
|
|||
fn test_use_loc() {
|
||||
check_location(r"use f$0", ImmediateLocation::Use);
|
||||
check_location(r"use f$0;", ImmediateLocation::Use);
|
||||
check_location(r"use f::{f$0}", None);
|
||||
check_location(r"use {f$0}", None);
|
||||
check_location(r"use f::{f$0}", ImmediateLocation::UseTree);
|
||||
check_location(r"use {f$0}", ImmediateLocation::UseTree);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue