diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-21 14:15:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-21 14:15:12 +0100 |
commit | c69f762f2673e9b671d91d7b8b110d8481f4ed07 (patch) | |
tree | e2d812e08875ef8d1f123e549c8269544bb9842c /crates/ide_completion/src/patterns.rs | |
parent | 488c9ef9c0c04e0afa291164db5d115d5515b00d (diff) | |
parent | 0729913525a55cad3ffe9876c1eb05f7b880d22d (diff) |
Merge #9356
9356: internal: Move out and regroup more completion tests 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 | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ide_completion/src/patterns.rs b/crates/ide_completion/src/patterns.rs index 271409c38..757c9a3da 100644 --- a/crates/ide_completion/src/patterns.rs +++ b/crates/ide_completion/src/patterns.rs | |||
@@ -31,6 +31,7 @@ pub(crate) enum ImmediateLocation { | |||
31 | Impl, | 31 | Impl, |
32 | Trait, | 32 | Trait, |
33 | RecordField, | 33 | RecordField, |
34 | TupleField, | ||
34 | RefExpr, | 35 | RefExpr, |
35 | IdentPat, | 36 | IdentPat, |
36 | BlockExpr, | 37 | BlockExpr, |
@@ -187,7 +188,13 @@ pub(crate) fn determine_location( | |||
187 | ast::SourceFile(_it) => ImmediateLocation::ItemList, | 188 | ast::SourceFile(_it) => ImmediateLocation::ItemList, |
188 | ast::ItemList(_it) => ImmediateLocation::ItemList, | 189 | ast::ItemList(_it) => ImmediateLocation::ItemList, |
189 | ast::RefExpr(_it) => ImmediateLocation::RefExpr, | 190 | ast::RefExpr(_it) => ImmediateLocation::RefExpr, |
190 | ast::RecordField(_it) => ImmediateLocation::RecordField, | 191 | ast::RecordField(it) => if it.ty().map_or(false, |it| it.syntax().text_range().contains(offset)) { |
192 | return None; | ||
193 | } else { | ||
194 | ImmediateLocation::RecordField | ||
195 | }, | ||
196 | ast::TupleField(_it) => ImmediateLocation::TupleField, | ||
197 | ast::TupleFieldList(_it) => ImmediateLocation::TupleField, | ||
191 | ast::AssocItemList(it) => match it.syntax().parent().map(|it| it.kind()) { | 198 | ast::AssocItemList(it) => match it.syntax().parent().map(|it| it.kind()) { |
192 | Some(IMPL) => ImmediateLocation::Impl, | 199 | Some(IMPL) => ImmediateLocation::Impl, |
193 | Some(TRAIT) => ImmediateLocation::Trait, | 200 | Some(TRAIT) => ImmediateLocation::Trait, |