Improved F# hints in Visual Studio

Petr Semkin

A few months ago, we introduced a preview of F# hints – the type and parameter name hints. Since then, we’ve fine-tuned them, added return type hints, and incorporated tooltips for all of them.

Explore the entire experience here:

Code
type Song = {
    Artist: string
    Title: string
}
type Playlist(songs) =
    member _.Add(artist, title) =
        { Artist = artist; Title = title } :: songs
    member _.Shuffle() =
        Algorithms.randomize songs

Overview

In this code, you can spot type hints, return type hints, and parameter name hints.

an image with all hints shown in the code

Note that all hints now feature tooltips:

an image showing a tooltip for a parameter name hint

Also, we refrain from displaying hints for certain obvious scenarios:

an image demonstrating a parameter name hint not shown when it coincides with the argument name

Enabling the Hints

These hints remain in preview and off by default.

You can configure each of them separately in options (Go to Tools -> Options -> Text Editor -> Advanced):

an image showing Visual Studio settings for the hints

Looking Forward and Getting Involved

In the long run, we aim to implement a hotkey for toggling hints, make them less intrusive, and include signature hints. You can find the full roadmap in this issue, and all related tickets are available using this query. Many of them are good first issues, and we warmly welcome any contributions!

8 comments

Discussion is closed. Login to edit/delete existing comments.

  • Georgi Hadzhigeorgiev 1

    That is great news, thanks Petr!

  • AVATAR Jake 1

    thanks Petr! What about format F# code in Visual Studio? Is there any functions in Visual Studio like Ionide for F# for VSCode to format code??

  • Mårten Rånge 3

    Hotkey for toggling type hints sounds like a very good idea. I personally don’t like having them enabled all the time but I see the benefit to toggle them on for a short while every now and then.

  • Андрій Чебукін 0

    There is an issue that the editor counts hints into line length. Can this be fixed?

    • Petr SemkinMicrosoft employee 0

      Hi, that’s interesting. I created a ticket for this and did some brief investigation. TLDR not clear if it’s a bug or a feature, we’ll look further.

  • Ed Maphis 0

    I’ve been trying the type hints and they are helpful, but they can get in the way and make things look too complicated. I think type hints would be more valuable if there was a keyboard combo to quickly turn them off and turn them back on.

    Thanks.

    • Ed Maphis 1

      Dang, I just read to the end of the article. Lol.

Feedback usabilla icon