Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

Navigation, find usages, file structure for F# scripts in Rider 2018.1 EAP!

Our latest EAP builds of Rider 2018.1 come with a number of F# scripting updates, such as several bugfixes related to Mono, and no longer requiring MSBuild 12 to be installed. We are also bringing more ReSharper features to the world of .fsx files: navigation in scripts, find usages and support for the file structure view. We also added code completion and navigation for #r and #load directives. Let’s check these out!

Navigation, find usages, file structure

Rider now supports more ReSharper features for scripts, such as navigation to symbols defined in scripts. For example, when using Search Everywhere (Ctrl+T in the Visual Studio keymap), we can see functions (and other members) from our .fsx file are now available:

Search everywhere now includes members from script files

When a script is opened in the editor, we can navigate to classes, functions, variables, and other members using Go to File Member (Alt+\):

Navigate to file member in .fsx script for FSharp

Speaking of file members: the File Structure tool window (View | Tool Windows | Structure or Ctrl+Alt+7) displays the structure of the script in the active editor tab. The File Structure view and editor tab are synchronized. We can navigate through our script using the mouse, or by typing a few characters and using the arrow keys.

Using the file structure tool window with FSharp script files

Find usages (Shift+F12) and other navigation features (Alt+`) now work as well, allowing us to figure out where certain symbols are used in our script file (or referencing script files):

Find Usages of symbols defined in an FSharp script

Code completion and navigation for #r and #load directives

Scripts often use the #r or #load directives to reference assemblies or include other script files. Rider 2018.1 brings smart completion for paths in these directives. We can use regular completion and traverse the complete tree, but using Smart Completion (Ctrl+Alt+Space), Rider will suggest applicable files from subdirectories:

Smart completion for relative paths in directives

Features like code completion and find usages work across scripts and project. When compiling the project and referencing its output assembly in a script, we can #r reference the assembly and get code completion for types from that assembly. What’s more: we can navigate to the type declaration, and from there find usages, mapping back to our script!

Code completion for referenced assemblies

We can navigate to included files using Ctrl+click or Navigate to Declaration (F12).

Navigate to included FSharp script file

Similarly, referenced assemblies are loaded in ReSharper’s index, making their symbols and members available for search and navigation, including navigation to decompiled sources using Rider’s built-in decompiler.

Navigate to referenced type from script file

We’d love to hear your feedback on these updated features! Give the latest Rider 2018.1 EAP build a try!

image description