ionide / ionide/FsAutoComplete

Add Support for Breaking Down Type Signatures in Tooltips

Open
#1,203 5 comments 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
F#
Stars
486
Forks
169
Avg merge
2d 8h
Merged PRs (30d)
5

Description

### Details

Assuming we have the following code:

```fsharp
type GetNumberFromDb = IDbConnection -> int

let getNumberFromDb : GetNumberFromDb =
fun conn -> 1

let addNumberFunc' (dbFunc : GetNumberFromDb) otherNumber conn =
let number = dbFunc conn
printfn "I got a number: %i" number
number + otherNumber

type AddNumberFunc = int -> IDbConnection -> int

let addNumberFunc : AddNumberFunc =
addNumberFunc' getNumberFromDb

let someHigherOrderFunction' (addNum : AddNumberFunc) num conn =
addNum num conn
// other logic here

type SomeHigherOrderFunction = int -> IDbConnection -> int

let someHigherOrderFunction : SomeHigherOrderFunction =
someHigherOrderFunction' addNumberFunc
```

When hovering over function parameters with a type signature such as below
![image](https://github.com/fsharp/FsAutoComplete/assets/38481538/021365dd-18ff-44db-8264-648d0774cc1f)

You can see the tooltip shows us the alias of the type signature (AddNumberFunc). I would like to propose we add the ability for navigating the type signatures further so you don't have to leave your current spot in the code to read and understand the signature.

Ideas/Suggestions:

1. Create a 'mathetical proof' style signature. We'd have to account for type aliases for primitive types and other sorts of F# magic. Depending on the size of the 'proof' placing this under the 'Open the documentation' section may prove better. Maybe adding configuration of some sorts as well?
```
addNumberFunc : AddNumberFunc
addNumberFunc : int -> IDbConnection -> int
```

If this is found to be a reasonable idea/suggestion, I'd be willing to help contribute. I would just need guidance on areas of the codebase to search and refactor

### Checklist

- [X] I have looked through existing issues to make sure that this feature has not been requested before
- [X] I have provided a descriptive title for this issue
- [X] I am aware that even valid feature requests may be rejected if they do not align with the project's goals
- [ ] I or my company would be willing to contribute this feature

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.