How-To's

Typing Assists, Code Analysis for Unused Opens, and More F# Updates in Rider

In our latest Rider 2018.3 release, we have made a number of updates to F# functionality: a bunch of new typing assists for brackets, quotes, indenting and more, code analysis for unused opens (and an optimize opens quick-fix), renaming of local symbols, updates to how Find Usages handles union cases and type specifications, and a fresh F# lexer. Let’s see!

New F# lexer implementation

Rider is the combination of the IntelliJ IDEA IDE user interface, with ReSharper running as a separate process that powers all .NET languages and features. In case you are interested in more background, we wrote an article on how the two work together.

In the latest release of Rider, we have updated the F# lexer that runs in the ReSharper process, to integrate better with existing functionality in the IDE and improve syntax highlighting and navigation for some operators.

While the lexer itself is not immediately visible, it does serve as the basis for most of the new F# features in Rider 2018.3.

Typing assists for brackets, quotes, parentheses…

The latest Rider release comes with a vast number of typing assists for F# to make the coding process more productive. For example, Rider will now auto-indent code when needed, inserts matching brackets, quotes, and parentheses, and so on.

FSharp typing assists in Rider

Typing assists are available for brackets, quotes, parentheses and many more constructs. Rider will also insert newlines when needed, and update indentation.

More typing assists for F#

Note: if you are interested in all situations where Rider’s typing assists will help out, have a look at our typing assist test cases.

Analyzing (and optimizing) unused opens

We’ve added a new code analysis into Rider, which checks for unused opens and comes with a corresponding quick-fix for removing unused opens. When our code does not use elements from imported namespaces, Rider will display the import declarations in gray. We can use Alt+Enter and the Remove unused opens quick-fix to remove them.

Remove unused opens quick fix

Note that the Remove unused opens quick-fix can not only be run for the current file, but also for the current folder, the current project, or our entire solution.

Renaming local symbols

While editing code, we can now rename local symbols using the Rename refactoring (Ctrl+R, R in the Visual Studio keymap). Rider will display an inline editor where we can rename the symbol, and will update the symbol name at the declaration and where it is used.

Rename local symbols in FSharp code using Rider rename refactoring

Future versions of Rider will also include support for renaming symbols across files.

Better grouping in Find Usages

Rider comes with the Find Usages action (Shift+F12 in the Visual Studio keymap), which lets us find usages of a symbol. Usages can be filtered and grouped, so we can drill down the list of usages.

With Rider 2018.3, we are adding a new group that displays usages of a symbol in pattern matching. This helps distinguish, for example, new instance creation from pattern matching:

Find Usages groups new instance creation and pattern matching

Find Usages now also distinguishes instance creation from using a type reference, for example when doing a type check.

Find usages groups type specifications

We would love to hear what you think of these updates! Download Rider 2018.3.1 and give it a try!

image description