Skip to content

Add Support for Breaking Down Type Signatures in Tooltips #1203

@1eyewonder

Description

@1eyewonder

Details

Assuming we have the following code:

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

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

  • I have looked through existing issues to make sure that this feature has not been requested before
  • I have provided a descriptive title for this issue
  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions