Closed automaticp closed 11 months ago
Yes, this is an issue with the current name-resolution/type-checking. I have been meaning to rewrite it for a while... Currently it simply does an upwards tree traversal, looking for any definitions that match the current name. In order to support overloading, it currently returns all matches (instead of just the first) since it isn't clever enough to compare the types of the function parameters. However, this is quite a large change, so you'll have to live with this for a while :slightly_frowning_face:
Of course, no pressure. This is totally a minor issue anyways.
I have an idea on how to fix this: essentially, we just pretty-print the types and compare the strings for equality. It's not totally fool-proof, but likely good enough as a MVP. But I've already done a lot tonight so might leave that for tomorrow.
Yeah, just don't send out identical responses from the same hover request. Maybe even condense multiple overloads into a singe lsp response too. Might be slightly harder to test, but it's rare to see multiple hover pop-ups on a single request. I didn't even know you could have that.
it's rare to see multiple hover pop-ups on a single request
Yes, ideally we would know which overload is being used, but without types that is not possible. I believe vscode gives a more reasonable UI for signature help, which we should also implement.
Declaring the same function multiple times produces a hint for each declaration. Quite noticeable if you like to declare helper functions at the top and define them at the bottom.