Code Issues visual presentation
CodeRush code issues technology highlights found issues right inside the Visual Studio code editor with different colors. There are two permanent bars with issue indicators to the left of the code editor, and to the right of the vertical scroll bar. The third optional bar is intended to view solution wide analysis statistics for files and projects. This bar appears at the bottom of the code editor, if enabled.
Let’s take a closer look at code editor highlighting and these three code issues bars.
As already noted, different types of code issues are highlighted with different color (which you can tweak). There are two ways of issue highlighting:
- a wavy underline
- a gray font for a source code.
A gray font is used for the Dead Code issue type. Other issue types use different colored underlines, such as red, blue, yellow, and green:
Hovering over these visual marks inside the code editor will show you the Code Fix hint:
This hint is an important part of visual presentation of code issues. It contains information about code issues and different ways of their fixing. This hint allows you:
- to see the list of issues found for a particular block of code
- to see a brief description for an issue in the list when hovering over it:
- to correct an issue by clicking the available fix provider link:
- to suppress or disable an issue in a different kind of scopes by clicking the blue triangle:
- to navigate between neighboring code issues using two green navigation buttons:
If the Code Fix hint overlaps the source code, you can move it to another place by dragging using the mouse. The hint can also be controlled using the keyboard. The following shortcuts are available:
|Arrow keys||Selects the next or previous fix link.|
|Tab||Navigates between the fix links and suppression triangles.|
|Enter||Applies the selected fix to correct an issue.|
|Esc||Hides the hint.|
Now, the three code issues bars.
The bar on the left marks the code issues inside of the active text view. So, the issues you see on the code editor screen are “mirrored” to the left bar on the corresponding lines where issue is highlighted. Hovering over a mark will show you the Code Fix hint.
The bar on the right consists of the two parts:
- document summary status on the top represented by a small icon indicating the issues state of the current source file (text document)
- marks of issues for the entire source file (text document)
The document summary indicator shows whether the current source file contains issues. The following states are available:
|The current document is being checked.|
|The current document does not contain any issues.|
|The current document contains hints.|
|The current document contains warnings.|
|The current document contains errors.|
If you hover over an icon – the hint with the status description appears:
The other part of the bar on the right shows code issues found inside of the entire source file. Hovering over this bar will show you the Code Fix hint or a list of Code Fix hints:
These hints shown from this bar has two more options:
- temporarily make visible the block of code with an issue. Once you hover over an issue, the code editor will be scrolled to the code with an issue. And if the hint is closed or mouse cursor is moved out of the hint, the code editor will scroll back to the initial starting position (before the hint appeared).
- navigate to the issue in question by clicking on it. If you click on the hint, the code editor will be permanently scrolled to the code block with an issue, so you can continue to work with it.
The last Project/File bar at the bottom of the code editor contains of two parts (lines):
- Solution files (at the top)
- Solution projects (at the bottom)
The project line lists all projects of the current solution. Project indicators are highlighted in one of the two blue colors. Hovering over the project line will show you the name of the project.
The files line lists all files of the solution. The indicators representing files are highlighted with a color according to its state. If the file contains errors, the indicator on the bar is highlighted in red, and so on. Hovering over the files line will show you the File Info hint with brief information about the file: the size of the file, the number of lines, the number of types and the count of warnings, errors and hints found in it:
If the solution contains hundreds or thousands of files, the optional Magnifier window is available for the files bar. You can tweak the number of file indicators shown in this window and the minimal width of the file indicator when the magnifier window must appear. This is what it looks like when both the File Info hint and Magnifier window are shown:
This post is a part of post series about CodeRush Code Issues technology. To learn more about code issues, please refer to the appropriate topics:
- Code Issues technology overview
- Code Issues types overview
- Code Issues visual presentation (current post)
- Code Issues fixes and suppression
- Code Issues navigation techniques
- Code Issues tool window
- Code Issues configuration and options
- Code Issues overall list
- Creating your own code issue