rust-analyzer/crates/ide-completion/src
Luiz Carvalho ed216e285d
fix(completion): make the expected type a tad smarter with Fns
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 behaviour on 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.
2024-01-02 10:28:49 -03:00
..
completions Auto merge of #16049 - dfireBird:followup-callable-fields, r=Veykril 2024-01-02 10:20:31 +00:00
context fix(completion): make the expected type a tad smarter with Fns 2024-01-02 10:28:49 -03:00
render fix(completion): make the expected type a tad smarter with Fns 2024-01-02 10:28:49 -03:00
tests Complete exported macros in #[macro_use($0)] 2023-12-16 16:19:58 +00:00
completions.rs 🧹 2023-11-28 10:55:40 +01:00
config.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
context.rs Auto merge of #16137 - unexge:complete-macros-in-macro-use, r=Veykril 2023-12-22 10:42:38 +00:00
item.rs Always render the path to be imported in the completion detail 2023-12-11 18:37:12 +01:00
lib.rs Complete exported macros in #[macro_use($0)] 2023-12-16 16:19:58 +00:00
render.rs Cleanup 2023-12-08 13:31:31 +01:00
snippet.rs Always render the path to be imported in the completion detail 2023-12-11 18:37:12 +01:00
tests.rs internal: Move out WithFixture into dev-dep only crate 2023-12-18 15:24:08 +01:00