One of the most boring parts during working with F# Script files is external references. We need to write a lot of directives with paths to the required files.
New Visual Studio 2013 can help here a bit. A new ‘Send to Interactive‘ button is available there. Now you can avoid typing an extra command to load references for interactive execution of a small part of your application. But what to do if F# script is our goal?
If you are VS2012 user, then one nice plugin from Tao Liu is available for you “AddReferenceInFSI“. It is a really nice extension, but it is still not a silver bullet.
What do real gurus do in such a situation? Tomas Petricek has shared one typing trick. You can find it in his latest Channel 9 video “Understanding the World with F#” starting from 4:40. What?!? How did he open file picker inside the source code file, chose file that he wanted and inserted relative path to the file directly in code? Why do I always type these long and boring paths if it can be done so easy? Today the truth will come true!
Thomas was so kind and revealed the secret of this trick:
The truth is not so magical as on the face of it – just use the power of your file editor. Let’s repeat all steps once again to better remember:
- Find a place where you want to insert file path
- Press Ctrl+O that should open a standard file picker. By default VS should open a dialog in the directory where your current file is saved in.
- Start typing relative or absolute path to your file, BUT do not use mouse – you are able to use only auto-complete in file path edit box.
- When you find a file – select path to it (Ctrl+A)
- Copy it (Ctrl+C)
- Close file picker (Esc)
- Insert path in your script (Ctrl+V)
Do not type boring paths – do it like Tomas 😉
Update from Yan Cui: There is one useful script from Gustavo Guerra. You can load it in every FSI session and save your time.
FSI console has a pretty small font size by default. It is really uncomfortable to share screen with projector. Source code in FSI is always small and hard to read. Never thought (until today) that I can configure font, color, font size and etc. In fact, it is very easy to do:
- Click Tools -> Options.
- Select Environment -> Fonts and Colors.
- In the ‘Show setting for‘ drop-down select ‘F# Interactive‘.
- Here it is – you can change whatever you want.
- That’s wonderful!
Sometimes, when you feel really alone and want a bit of heat then F# can help you here.
All you need is a laptop and F#. Just type the following snippet into FSI and wait for a minute. =)
[|1..999|] |> Array.Parallel.iter (fun _ ->
while true do ignore())
Wish you warm Christmas!
P.S. The same solution works when you are freezing.
When I saw a Sublime Text 2 with their features at first time – I loved that. One of my favorite feature is a minimap. It is a simple but very powerful idea to replace scrollbar with minimized code map. Using this feature very easy navigate directly to where you want.
I wanna this feature for Visual Studio for sure. Fortunately, it is already there. It is a part of the Productivity Power Tools.
First of all we need to setup Productivity Power Tool using Visual Studio Extension Manager.
We need to enable this feature, because it is disabled by default. Open Tool -> Options -> Productivity Power Tools, enable Enhanced Scroll Bar and restart your Visual Studio.
Choose ‘Full map mode‘ in the Productivity Power Tools->Enchanced Scroll Bar section.
You should see minimaps in your Visual Studio now. Enjoy it!!!
Replaceable parameters, can be used inside project files to provide values for SharePoint solution items whose actual values are not known at design time. For more information, see http://msdn.microsoft.com/en-us/library/ee231545.aspx.
If you want to be able create new Silverlight 4 applications in Visual Studio 2010 you need to install Silverlight 4 Tool
If you want debug Silverlight application, you need to uninstall current version of Silverlight before installation Silverlight Tools. During the installation on your machine will be installed developers version of Silverlight.