{"id":46378,"date":"2023-07-05T10:05:00","date_gmt":"2023-07-05T17:05:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=46378"},"modified":"2023-07-05T14:16:33","modified_gmt":"2023-07-05T21:16:33","slug":"improved-fsharp-hints-in-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/improved-fsharp-hints-in-visual-studio\/","title":{"rendered":"Improved F# hints in Visual Studio"},"content":{"rendered":"<p>A few months ago, we introduced a preview of <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/fsharp-inline-hints-visual-studio\/\">F# hints<\/a> &#8211; the type and parameter name hints. Since then, we&#8217;ve fine-tuned them, added return type hints, and incorporated tooltips for all of them.<\/p>\n<p>Explore the entire experience here:\n<div style=\"width: 640px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-46378-1\" width=\"640\" height=\"360\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/07\/demo.mp4?_=1\" \/><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/07\/demo.mp4\">https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/07\/demo.mp4<\/a><\/video><\/div><\/p>\n<details>\n<summary>Code<\/summary>\n<pre><code class=\"language-fsharp\">type Song = {\n    Artist: string\n    Title: string\n}\ntype Playlist(songs) =\n    member _.Add(artist, title) =\n        { Artist = artist; Title = title } :: songs\n    member _.Shuffle() =\n        Algorithms.randomize songs<\/code>\n<\/details>\n<h2>Overview<\/h2>\n<p>In this code, you can spot type hints, return type hints, and parameter name hints.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/07\/all-hints.png\" alt=\"an image with all hints shown in the code\" \/><\/p>\n<p>Note that all hints now feature tooltips:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/07\/tooltips-for-hints.png\" alt=\"an image showing a tooltip for a parameter name hint\" \/><\/p>\n<p>Also, we refrain from displaying hints for certain obvious scenarios:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/07\/hints-not-shown.png\" alt=\"an image demonstrating a parameter name hint not shown when it coincides with the argument name\" \/><\/p>\n<h2>Enabling the Hints<\/h2>\n<p>These hints remain in preview and off by default.<\/p>\n<p>You can configure each of them separately in options (Go to Tools -&gt; Options -&gt; Text Editor -&gt; Advanced):<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/07\/hints-in-visual-studio-options.png\" alt=\"an image showing Visual Studio settings for the hints\" \/><\/p>\n<h2>Looking Forward and Getting Involved<\/h2>\n<p>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 <a href=\"https:\/\/github.com\/dotnet\/fsharp\/issues\/14157\">in this issue<\/a>, and all related tickets are available using <a href=\"https:\/\/github.com\/dotnet\/fsharp\/labels\/Area-LangService-Hints\">this query<\/a>. Many of them are <a href=\"https:\/\/github.com\/dotnet\/fsharp\/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22\">good first issues<\/a>, and we warmly welcome any contributions!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;re introducing new F# hints and enhancing existing ones.<\/p>\n","protected":false},"author":112074,"featured_media":46379,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,636,646],"tags":[7708,73,7707,147],"class_list":["post-46378","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-fsharp","category-visual-studio","tag-developer-experience","tag-f","tag-hints","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>We&#8217;re introducing new F# hints and enhancing existing ones.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/46378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/112074"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=46378"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/46378\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/46379"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=46378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=46378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=46378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}