Jun 26

F# for Visual Studio

F# for Visual Studio provides several features which greatly help writing F# code, both in general and specifically when using the .NET APIs.

  • Codesense. Within Visual Studio, F# will typecheck your file as you type.
  • TypeTips. Hovering over identifiers will report their type. Languages with automatic type inference are fantastic for authoring code. This extension to VS allows readers of the code to see the types without needing to work them out.
  • Intelisense. This allows for discovering possible completions based on type and context. It is activated when you press a “.” (dot) after an object name or directly via CTRL-J. This enables rapid discovery of APIs.
  • MethodTips. F# for Visual Studio displays the calling signatures for methods as they are selected. This information is available for both F# values and .NET members.
  • PatternTips. F# for Visual Studio displays the …

See the F# intellisense screenshots from Don’s F# Blog.

So, for example, if you have the following code:

    let gc = System.Drawing.Graphics.FromImage(im)
    do gc.Draw

typing CTRL-J after gc.Draw will give a menu of possible Draw* methods on gc and hovering over gc reports it’s type as Graphics.

F# for Visual Studio Installation

To install F# for Visual Studio, see the instructions in your release’s “README-fsharp.html” file.

F# project properties

You can refer to additional .dlls in your project by adding:

    -r extra.dll

to the command line options under the F# project properties. Note, the F# Intelisense process is given these options when it is started, so restart Visual Studio to make Intelisense detect dll reference changes.

Leave a Reply