-
Notifications
You must be signed in to change notification settings - Fork 2
Basic Getting Started
A couple days ago I sat down an evening and built v0.1 of the F# language plugin to OpenIDE. This post will in detail explain how to get started using it.
First of all you need to install OpenIDE. You install it by creating a directory like /home/you/bin or C:\Users\you\bin or whatever suits your needs. Inside this folder clone this git repository https://github.com/continuoustests/OpenIDE.binaries. When done add the full path of your OpenIDE.binaries folder to the PATH environment variable. When done you should be able to run the oi command in a terminal and get output printed. Last let's install the F# package. There are two packages in the repository for F# (oi package src list
lists available packages). A F# language plugin with ContinuousTests/AutoTest.Net and one without. We will ose the one with ContinuousTests. Run this command to install the plugin oi package install F-Sharp-AT -g
.
PS!!
if on osx also run oi conf interpreter.exe=mono -g
and oi conf oi.fallbackmode=disabled -g
if on linux also install wmctrl
For reasons of simplicity we will look at setting up Sublime specifically. First of all let's tell OpenIDE where Sublime is located by giving it the path to it. For some reason is not happy with the Application path on osx so if on osx create a symlink to subl. In a terminal run the following command oi conf editor.sublime.executable=/your/path/to/subl -g
. This will tell OpenIDE where to find OpenIDE and the -g option makes the configuration global to your install of OpenIDE. Since we are at it let's make Sublime our default OpenIDE editor too by running oi conf default.editor=sublime -g
.
Next we want to install the Sublime editor extension. It is not in Sublimes package repository yet so let's perform a manual install. From Sublime run the "Browse Packages" command using Ctrl+Shift+P or just navigate your way into the directory where Sublime keeps packages. Inside this directory create a folder named EditorEngine and place this file inside of it (https://raw.githubusercontent.com/continuoustests/EditorEngine.Sublime/master/SublimeText3/EditorEngine.py). If you are using Sublime 2 manipulate the url to fetch the one for Sublime 2. The last thing we need to do is to set up keyboard shortcuts for Sublime. Go to your "Key Bindings - User" configuration file in Sublime and add the { "keys": ["ctrl+shift+j"], "command": "go_to_auto_test_net" }, setting to have Ctrl+Shift+J bring ContinuousTests/AutoTest.Net to front.
Now let's create a folder to try out some code. Something like /home/you/src/tmp/FSharpInOpenIDE. Cd inside this folder from a terminal and run the command oi init f#
. This creates an OpenIDE configuration point and tells it that inside here we will be working with F# stuff. Since we have a configuration point now let's fire up the system. Now we want to launch Sublime and ContinuousTests. This is done by running oi editor
. You should now from within Sublime be able to hit Ctrl+Shift+J to bring ContinuousTests to front.
Let's jump back to the terminal and create a F# console project by running oi create console src/SampleConsole
. A project was now created in the src/SampleConsole folder, the Program.fs file was opened in the editor and ContinuousTests built the application in the background. If you want to try and run it you can find the executable at src/SampleConsole/bin/AutoTest.Net/SampleConsole.exe. We can now make some changes to this file and ContinuousTests will provide you with build/test information. If you get a compile error you can navigate to ContinuousTests and click on the error or stacktrace to go to that location in the editor. Hit i at any line in ContinuousTests to open the details window.
If you want to add a new F# file to your project run the command oi new file src/SampleConsole/MyNewFile Program.fs
. Program.fs in this command represents the file you want to place the new file before in the project file. If left out it will place the file first.
For a list of command available for the F# plugin run oi help f#
.
The plugin is the work of one evening and my F# skills are not awesome so if interested please get involved :) The plugin itself is written in F#.
-ack