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

Maarten Balliauw

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!

Comments below can no longer be edited.

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

  1. Maximilian Beckenbach says:

    December 10, 2018

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

    • Edoardo Luppi says:

      December 10, 2018

      I really hope a similar feature will be ported to IDEA.

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

    December 11, 2018

    […] Rider 2018.3のEAPでCodeVisionというものが有効になるらしい。 Code Vision in Rider: Enriching the Editor with Contextual Information and Navigation(https://blog.jetbrains.com/dotnet/2018/12/10/code-vision-rider-enriching-editor-contextual-informati&#8230😉 […]

  3. Laurent Kempé says:

    December 11, 2018

    This is awesome! Looking forward to try it.

  4. Daniel says:

    December 11, 2018

    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.

    • Maarten Balliauw says:

      December 11, 2018

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

      • AD says:

        May 8, 2019

        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. Dew Drop - December 11, 2018 (#2857) - Morning Dew says:

    December 11, 2018

    […] Code Vision in Rider: Enriching the editor with contextual information and navigation (Maarten Balliauw) […]

  6. Andrey says:

    December 13, 2018

    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:

    December 16, 2018

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

  8. Markus says:

    December 18, 2018

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

    • Maarten Balliauw says:

      December 18, 2018

      Absolutely, best is to try “Navigate To” (Alt+` on VS keyboard scheme) to discover all others.

      • Markus says:

        December 18, 2018

        This doesn’t seem to have all actions in it (I’m using `CTRL+SHIFT+G` from Intellij), right?

        I can’t trigger the action for VCS change or the Show `Find Usages` uses the normal tool window instead of the floating one I get in the gif above.

        I`d like to be able to trigger them with shortcuts, because I love that I don’t have to move my eyes all the way across to the opening tool windows.

        But nonetheless, nice feature, I’ll definitely use it!

  9. Thomas Ingram says:

    December 18, 2018

    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.

    • Maarten Balliauw says:

      December 19, 2018

      For the moment, it uses the color setting for ‘unused symbol’.

  10. John says:

    December 19, 2018

    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.

    • Ilya says:

      December 23, 2018

      This would be really handful and convinient.

    • Neal McConachie says:

      May 17, 2019

      Yeah – it’s excess noise a lot of the time, but sometimes useful. Being able to toggle it on and off would be great.

      • Maarten Balliauw says:

        May 17, 2019

        There is no quick toggle from the Search Everywhere tool window, but it can be enabled/disabled easily in the settings.

  11. Gregor says:

    January 1, 2019

    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:

    August 15, 2019

    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?

    • Maarten Balliauw says:

      August 17, 2019

      That should not happen. Would you mind opening an issue (via Help | Report a Bug)?

  13. noone says:

    December 10, 2019

    When will Code Vision be available in Intelij?

Subscribe

Subscribe to .NET Tools updates