chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.77k stars 416 forks source link

[Feature Request]: let CLS return a list of definitions for overloaded functions #25289

Open lucaferranti opened 2 months ago

lucaferranti commented 2 months ago

If I have an overloaded function like

proc f(x: int) {return 1;}

proc f(x: real) {return 2;}

var b = f(1.0);

when I query for the definition of f in the function call above, the language server doesn't do anything (note that if I remove the second function def it works).

Instead, it would be nice to return the list of definitions and let the user choose which one to go to. I see editors support this in other programming languages, so I would guess this is somehow possible with the LSP protocol (but haven't check). In the picture below, an example of how it is for Julia

ex

DanilaFe commented 2 months ago

Thank you for reporting!

It's definitely possible using LSP, and is more of a limitation with the language server / compiler frontend. Currently, we don't keep a list of all identifiers that matched when looking up functions. What would be needed is to plumb such a list through, somehow -- which definitely seem plausible.