Code Vision in Rider: Enriching the Editor with Contextual Information and Navigation

Code Vision - Visibility into your source code with Rider

Good news, everyone! The latest Rider 2018.3 Early Access Preview (EAP) build comes with Code Vision, an easy way to focus on our code while getting additional information about it.

One of the first things you will notice when opening the editor in Rider is the extra information displayed at the top of classes, interfaces, and members:

Rider's Code Vision in action

Code Vision lets us focus on our code, enriched with contextual information and navigation, such as version control info (who last changed a type or member), usages, derived types, extension methods, exposing APIs, and more.

Information displayed by Code Vision is contextual, relating to the declaration it is displayed on, as well as actionable. Each bit of information, called a metric, can be clicked to reveal additional details.

For example, we can easily toggle version control annotations by clicking the author, or look at inheritors of our IIssuesService here, and then navigate to them:

Click code vision to reveal more information and navigate around

Note: solution-wide analysis has to be enabled (and completed) for some metrics to become visible with Code Vision.

Just like with regular navigation commands (try Navigate To or Alt+` anywhere in your code), results can be displayed in the Find Results tool window as well, where we can continue exploring our code base:

View results in separate Find results tool window

By default, Rider displays 5 metrics in Code Vision, as well as a More link. When clicked, it opens a popup with all available metrics for a declaration, including those that may be hidden in the editor. It also provides an easy way to access Code Vision settings.

Getting more code vision metrics and access to settings

Code Vision metrics position

Code Vision information is displayed above declarations by default, but it’s possible to configure a different position. For example, we can display navigation metrics above declarations, and move VCS information next to it:

Configuring code vision position above or next to declaration

Metric position can be configured from Rider’s settings, under Editor | Code Vision. Metrics can be repositioned individually, or all at once. The list of available metrics can also be re-ordered.

Code Vision settings

How does it work? Are other metrics coming?

Right now, Code Vision is available for C# and VB.NET. Code Vision is based on the various indexes Rider has available. VCS information is retrieved from Rider’s built-in version control integration and works with Git, Mercurial, Subversion, TFVC, and more. Contextual navigation such as viewing usages, extension methods, overrides, and exposing APIs are retrieved from solution-wide analysis.

We are working on adding more metrics to Code Vision. Rider has many other types of information available internally, so we could add metrics for F# type information, dotTrace runtime information for methods, unit testing, and others.

Which metrics do you want to see? Let us know through the comments!

Download Rider 2018.3 EAP and give it a try! We’d love to hear your feedback!

About Maarten Balliauw

Maarten Balliauw is a Developer Advocate at JetBrains, working on .NET tools. He focuses on .NET, Azure, web technologies and application performance. Maarten is a frequent speaker at various national and international events. In his free time, he brews his own beer. Follow him on Twitter or check his personal blog.
This entry was posted in How-To's and tagged , , , . Bookmark the permalink.

23 Responses to Code Vision in Rider: Enriching the Editor with Contextual Information and Navigation

  1. Maximilian Beckenbach says:

    This is so awesome! The same feature for Angular Projects in Typescript, SCSS, HTML (Using Angular’s language service) would be life changing.

  2. Pingback: RiderのCodeVisionはVisual StudioのCodeLensっぽいもの | かるあのメモ on Wordpress

  3. This is awesome! Looking forward to try it.

  4. Daniel says:

    I have to disagree about the usefulness of this feature. I disabled CodeLens in VS 2017 exactly because it provided too much information, which was distracting.
    I, on the contrary, would appreciate a plugin that would show only the files, code areas, tests related to the class/method/task I’m working on.

    Like Eclipse Mylyn. I keep asking for it, but nobody listens..
    https://en.wikipedia.org/wiki/Task-focused_interface.

    Maybe this CodeVision should be available with a toggle keys combination, or as a report.
    Once in a while I would press some keys and have the information displayed in the editor. Then I would press the opposite combination and hide the information.

    • You can disable Code Vision in the settings if you want.

      • AD says:

        This response deliberately ignores what he’s requested, switchable state of Code Vision from a shortcut. Coming from 3ds Max, wherein there’s a bunch of switches for this sort of modality and viewing information level changing, I see what’s being requested as natural. Not something to deliberately avoid by pointing out what has already been described in the above blog post, twice.

        This kind of tone deaf response might be indicative of the reasons the OP is annoyed about not having his other (quite reasonable) request for a task focused plugin and/or facilities. Something that’s also quite well done in 3ds Max.

  5. Pingback: Dew Drop - December 11, 2018 (#2857) - Morning Dew

  6. Andrey says:

    The feature is cool, but this is what I personally dislike:
    1) Usages are not shown until solution scan is fully complete. I switch branches a lot, and full solution scan takes time for big solutions. Visual Studio immidiately shows usages.
    2) Git history shows only users that commited to the latest version of at least one line of the function. For example I can’t determine who created a function.
    Overall now I have one less reason to use Visual Studio. Thank you, Jetbrains.

  7. John says:

    That’s a great feature. I just hope there are plans to add it to Java / IDEA.

  8. Markus says:

    Looks nice, is there a way to trigger stuff with keyboard shortcuts?

  9. Thomas Ingram says:

    What Colour Scheme setting does this use? It’s way to bright in the VS dark colour scheme imo so I’m overwhelmed by something I’d be already overwhelmed by if it was almost transparent.

    This feature, along with inline parameter name hints is too much for me in its current iteration, but I love the concept. I wish tooltips had highlighting and provided a lot of this functionality. Give them these buttons, let me hover over parameters and additionally get their names. That way you have the best of both worlds: an uncluttered interface and contextual single-click information.

  10. John says:

    Is it possible to display Code Vision only while pressing a key? It is not necessary to see it all the time. I want to see it only while I press, for example, ALT key.

  11. Gregor says:

    The idea is great but I find it really distracting, especially the interactive nature (mouse over cursor and click opens a menu).

    I think there should be no interactive elements in the code itself.
    It often gets in the way of me navigating the code, especially the one placed next to the declaration.

    I would prefer to have this information in a separate pane on the left or right of the code or at least be able to toggle it on demand as John mentioned.

  12. LukaszC says:

    Code Vision only works for a split second. When I open a project, I can see the counts over methods for a split second. Then, everything disappears. I have Code Vision and solution-wise analysis enabled. Do I need to do anything else to make it work?

Leave a Reply to Laurent Kempé Cancel reply

Your email address will not be published. Required fields are marked *