diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-14 16:17:03 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-14 16:17:03 +0000 |
commit | a0322defc375d7fd3890225768a85a31f2bdb0be (patch) | |
tree | e09243414c566cde0ecdb500e7441bf21ead1d0e /crates/assists/src/handlers/generate_function.rs | |
parent | d50a37d3aa473937919030b39587df3d93f9bd8c (diff) | |
parent | 8ac6041bcf7c970104939bdbdda5af4873ebd472 (diff) |
Merge #7656
7656: Implement constructor usage search for almost all items r=matklad a=Veykril
This PR moves the filering for enum constructors to the HIR, with this unprefixed variants as well as when the enum has been renamed via use will then still show up properly.
We now walk the ast of the `NameRef` up until we find a `PathExpr`(which also handles `CallExpr` for tuple-type structs and variants already) or a `RecordExpr`. For enum search we then take the `path` out of that expression and do a resolution on it to compare it with the definition enum.
With this PR we now support searching for all constructor literals, Unit-, Tuple- and Record-Structs, Unit-, Tuple- and Record-Variants as well as Unions.
There is one shortcoming due to how the search is triggered. Unit Variants constructors can't be searched as we have no position for it to kick off the search(since a comma doesn't have to exist for the last variant).
Closes #2549 though it doesn't implement it as outlined in the issue since the reference kind was removed recently, though I believe the approach taken here is better personally.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers/generate_function.rs')
0 files changed, 0 insertions, 0 deletions