diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-17 13:01:43 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-17 13:01:43 +0100 |
commit | c82a9141abe6b6cbf5b55710dc8a315a3839081b (patch) | |
tree | 1d130833fa51a6fd46e3ff61f3f68155e546c535 /crates/ide_completion/src/patterns.rs | |
parent | 3b58d8f785917b4212cd917fced6c3006210e4d3 (diff) | |
parent | 9353f36516e5b4026ce3a181d578c3a63876a18f (diff) |
Merge #9310
9310: internal: Refine and test UseTree completions r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/patterns.rs')
-rw-r--r-- | crates/ide_completion/src/patterns.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ide_completion/src/patterns.rs b/crates/ide_completion/src/patterns.rs index 62e4334de..271409c38 100644 --- a/crates/ide_completion/src/patterns.rs +++ b/crates/ide_completion/src/patterns.rs | |||
@@ -27,6 +27,7 @@ pub(crate) enum ImmediatePrevSibling { | |||
27 | #[derive(Clone, Debug, PartialEq, Eq)] | 27 | #[derive(Clone, Debug, PartialEq, Eq)] |
28 | pub(crate) enum ImmediateLocation { | 28 | pub(crate) enum ImmediateLocation { |
29 | Use, | 29 | Use, |
30 | UseTree, | ||
30 | Impl, | 31 | Impl, |
31 | Trait, | 32 | Trait, |
32 | RecordField, | 33 | RecordField, |
@@ -180,6 +181,8 @@ pub(crate) fn determine_location( | |||
180 | match parent { | 181 | match parent { |
181 | ast::IdentPat(_it) => ImmediateLocation::IdentPat, | 182 | ast::IdentPat(_it) => ImmediateLocation::IdentPat, |
182 | ast::Use(_it) => ImmediateLocation::Use, | 183 | ast::Use(_it) => ImmediateLocation::Use, |
184 | ast::UseTree(_it) => ImmediateLocation::UseTree, | ||
185 | ast::UseTreeList(_it) => ImmediateLocation::UseTree, | ||
183 | ast::BlockExpr(_it) => ImmediateLocation::BlockExpr, | 186 | ast::BlockExpr(_it) => ImmediateLocation::BlockExpr, |
184 | ast::SourceFile(_it) => ImmediateLocation::ItemList, | 187 | ast::SourceFile(_it) => ImmediateLocation::ItemList, |
185 | ast::ItemList(_it) => ImmediateLocation::ItemList, | 188 | ast::ItemList(_it) => ImmediateLocation::ItemList, |
@@ -373,8 +376,8 @@ mod tests { | |||
373 | fn test_use_loc() { | 376 | fn test_use_loc() { |
374 | check_location(r"use f$0", ImmediateLocation::Use); | 377 | check_location(r"use f$0", ImmediateLocation::Use); |
375 | check_location(r"use f$0;", ImmediateLocation::Use); | 378 | check_location(r"use f$0;", ImmediateLocation::Use); |
376 | check_location(r"use f::{f$0}", None); | 379 | check_location(r"use f::{f$0}", ImmediateLocation::UseTree); |
377 | check_location(r"use {f$0}", None); | 380 | check_location(r"use {f$0}", ImmediateLocation::UseTree); |
378 | } | 381 | } |
379 | 382 | ||
380 | #[test] | 383 | #[test] |