F# for MonoDevelop

MonoDevelop is a cross-platform and open-source Integrated Development Environment. It supports many modern IDE features such as code completion, information tool tips and background error checking. The standard installation of MonoDevelop supports a wide range of languages that can be used with .NET and Mono platforms including C#, Visual Basic and IL. However, MonoDevelop has a rich extensibility model that makes it possible to write plugins that provide support for other languages.

This web page describes an open-source project that implements MonoDevelop support for the F# language. The project is built on top of the F# compiler services (that are also used by the Visual Studio integration). Currently, the aim is to provide consistent “user experience” for various platforms when creating small and medium F# projects (for example, when teaching F#).

Screencast on installing and using the F# plugin

If you want to see the F# integration in action, watch the following screencast. It shows how to install the F# support using the MonoDevelop plugin system and it demonstrates the F# integration with two examples. The first example uses F# Interactive to asynchronously download and process web pages and the second example shows an F# project with Windows Forms user interface.

The screencast demonstrates the following features of the F# plugin:

Identifier completion – The editor automatically suggests identifiers such as member names after the “.” symbol. You can also hit Ctrl+Space to get all identifiers available in the current scope (such as variable and type names).

Tool tips – When you place mouse pointer over an identifier, a tool tip with information about the identifier appears. Tool tips usually show type signatures, list of members of types etc.

Background type-checking – The F# compiler runs as a background process and checks the edited file for parsing errors as well as type errors. Errors are immediately shown using red underlining.

F# Interactive pad – The plugin adds F# Interactive as a new tool window to MonoDevelop. You can use it to interactively evaluate F# code written in the editor as well as for writing simple code snippets to test things.

Installation instructions

Before you can install the F# plugin for MonoDevelop, you need to install a few prerequisites. The easiest option is to follow the installation guide in the CrossPlatform F# section of this web site. Briefly, you need to install F# and add most of the F# assemblies (FSharp.Core and FSharp.Compiler*) to the Global Assembly Cache. Then you either need fsharpc script created by F# packages or you need to set FSHARP_COMPILER_BIN environment variable, so that plugin can locate the F# installation. For more details, go to the F# plugin prerequisites page.

For a more detailed step by step guide on how to install F# plugin, watch the above screencast. The installation is quite simple and it can be done from the MonoDevelop user interface.

Start MonoDevelop and go to Tools – Add-in manager. There you can install addins by pressing the Install Add-ins button.

The F# plugin is not available in the standard MonoDevelop repository, so you need to register a new repository. Click on the Repositories button and add a repostiroy http://functional-variations.net/addin.

After adding the repository, you should see F# Language Binding under the Language Bindings group in the Add-in Installation dialog. Select the plugin and click Forward to start the installation…

Installing F# for MonoDevelop on Windows

A bug in MonoDevelop may cause an issue when installing the F# plugin for MonoDevelop on Windows. In that case, you can try downloading the repository with plugin as a ZIP file. Then try installing the plugin from a local folder. Another alternative is to just copy the add-in binaries to the AddIns/BackendBindings directory in your MonoDevelop installation folder. This manual method should always work. The mpack file in the zipped repository is actually a ZIP, so if you rename it, you can extract two DLL files (FSharpBinding.dll and FSharpBinding.Gui.dll) from there.

Source code & developers

The F# plugin is open-source and is distributed under the Apache 2.0 license. The source code is available on GitHub as a repository maaged by the F# open-source organization.

You can read mor about the organization and its purpose in this blog post.
For more information about building the F# plugin, see also this page.
To compile the source code, you can do one of the following:

On Windows, you can use Visual Studio. Open and build the FSharp.MonoDevelop.sln solution in the FSharp.MonoDevelop subdirectory. This is tested using Visual Studio 2008. You may have to correct some references depending on your installation. Using MonoDevelop (with F# plugin) should also work (but it is not largely tested).

On Linux/Mac, you can use make. To generate Makefile, you can use ./configure.sh commnd that tries to locate paths of all required components (and asks you if it cannot find them automatically).

The command line steps to generate Makefile and use it are following:

# Generate Makefile using the confiure script
./configure.sh

# Compile C# GUI project and F# Language binding (all)
make

# Copy/remove the compiled `dll` files to/from the MonoDevelop
# Addins directory (so that you can easily test the plugin)
make install
make uninstall

# Build a package for the MonoDevelop online plugin repository
make package