fsharp
fsharp copied to clipboard
Tooling suggestion: show function's capture list on hover
Suggestion
It would be nice if F# tooling could show a list of values captured by a given function, member (e.g., in object expressions), or lambda on hover. I have often wished for this feature when reading code as well as during refactoring.[^1]
E.g., given something like
let x = 3
let mutable y = 99
let f g = g x + y
I would want hovering over f to show that x and y were captured. I'd ideally also want it shown that y was captured as a mutable value.
Additional context
The C# tooling has supported this for quite some time (via Roslyn).
[^1]: A capture-aware "extract/move function" feature would of course also be useful, but here I am only suggesting that we surface the information to the developer.