forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#16136 - saiintbrisson:fix/completion/a-tad-sm…
…arter-with-fns, r=Veykril fix(completion): make the expected type a tad smarter with `Fn`s This commit changes how the expected type is calculated when working with Fn pointers, making the parenthesis stop vanishing when completing the function name. I've been bugged by the behavior of parenthesis completion for a long while now. R-a assumes that the `LetStmt` type is the same as the function type I've just written. Worse is that all parenthesis vanish, even from functions that have completely different signatures. It will now verify if the signature is the same. While working on this, I noticed that record fields behave the same, so I also made it prioritize the field type instead of the current expression when possible, but I'm unsure if this is OK, so input is appreciated. ImplTraits as return types will still behave weirdly because lowering is disallowed at the time it resolves the function types. ![image](https://github.com/rust-lang/rust-analyzer/assets/29989290/c06d6c93-5cac-4ebe-a93b-923017a6ae8c) ![image](https://github.com/rust-lang/rust-analyzer/assets/29989290/31594d82-fa4d-446c-a77e-47e9de1a9a67) ![image](https://github.com/rust-lang/rust-analyzer/assets/29989290/cf33856e-a485-411b-91af-11090d78a44e)
- Loading branch information
Showing
4 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters