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.
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.
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.
Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…
Cloud management is difficult to do manually, especially if you work with multiple cloud…
Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…
https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…
FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…
Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…
View Comments
In case you get this error "Running the contributed command:'fsi.SendSelection' failed", you will have to include the PATH to fsi.exe in your PATHs. Read [link](https://github.com/ionide/ionide-vscode-fsharp/issues/4) for information.
In case you get this error "Running the contributed command:'fsi.SendSelection' failed", you will have to include the PATH to fsi.exe in your PATHs. Read [link](https://github.com/ionide/ionide-vscode-fsharp/issues/4 ) for information.
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?
I'm a bit rusty with all of this now, but you would use FAKE to compile - http://fake.build/index.html
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!