Blog

A Quick Look at F# In Visual Studio Code

It’s F# Advent time again! This is a yearly event the F# community comes together for the month of December and each person releases an F# related post on a day of their choosing. Today is that day for me this year.

With the recent announcement at Microsoft’s Connect() conference, Visual Studio Code now has an awesome update that can install extensions. With me being an F# fanatic I got excited to see that actually using F# is one of the first extensions available via Ionide which is originally made for developing in F# in GitHub’s Atom client.

While you could technically already “use” F# in Visual Studio Code, it was only for syntax highlighting. You couldn’t run any of the code. This quick post will help show you the steps to started developing F# within Visual Studio code.

The original creator of Ionide, Krzysztof Cieślak, did a great guest post for the .NET Blog to help announce F# support for VS Code. I figured I’d do my best to extend on it with this post.

Installing the F# Extensions

If you’re used to Atom or Sublime you’re already familiar with the command palette in Visual Studio Code (scroll down to the Command Pallete section). If not, just hit Cmd+P for the Mac version..

In here, just type in ext install f# and you’ll get a list of available F# extensions. The first one is for FAKE (which we have a few posts detailing some uses) and the second one is the main F# extension we’ll use.

The next one that you’d want to install is Paket. Think of this as NuGet on steroids. Once these are all installed go ahead and restart VS Code to use them.

Using the F# Interactive (FSI)

Now that the extension is installed, you can now create .fs or .fsx files in Visual Studio Code and execute the code in there in the F# interactive.

First, to launch the FSI, go back to the command palette and enter >fsi start. This will launch another split window with the FSI.

And, of course, we now have intellisense for F#.

In all of your F# code, you can send directly to the interactive window. I’m using >fsi send selection in the command palette here to send the highlighted selection to the FSI.

Although, at the time of this writing, you can’t type directly into the interactive window.


Of course, this is just the very beginning of what can be done with VS Code with F# as more and more features will be supported in Ionide. Look for more posts on all of those here. This is a great beginning for F# cross-platform development and I can’t wait to see where all of this goes.

Jonathan Wood

View Comments

  • Nice blog. I have been trying to work out how you managed to get the FSI/Output window in 'side-by-side' mode in VS Code? It only seems to appear below for me. I've tried everything I can think, looked for a config setting, and even asked the good folks at stack overflow (http://stackoverflow.com/q/36702207/2455494) but drew a complete blank. What am I missing?

  • Nice blog. I have been trying to work out how you managed to get the FSI/Output window in 'side-by-side' mode in VS Code? It only seems to appear below for me. I've tried everything I can think, looked for a config setting, and even asked the good folks at stack overflow (http://stackoverflow.com/q/36702207/2455494) but drew a complete blank. What am I missing?

    • The comment in your StackOverflow may be correct. I was using VS Code for this post *right* when it was announced that they included extensions in it. Unfortunately, I haven't played around with it much lately and it could have changed. If I find anything, though, I'll let you know!

  • so quick that this leaves you with a program that cant actually compile / run a bit of f#?
    is that useful? how to link to a compiler?

  • The comment in your StackOverflow may be correct. I was using VS Code for this post *right* when it was announced that they included extensions in it. Unfortunately, I haven't played around with it much lately and it could have changed. If I find anything, though, I'll let you know!

Recent Posts

8-Step AWS to Microsoft Azure Migration Strategy

Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…

2 days ago

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

1 week ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

3 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago