dotnet / dotnet/fsharp

Tooling suggestion: show function's capture list on hover

Open
#17,444 0 comments 3 reactions 0 assignees View on GitHub
Area-LangService-ToolTips Area-LSP Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

## 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

```fsharp
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.