Understand by SciTools is a popular platform for code comprehension and maintaining legacy code. This plugin shows the static analysis results from Understand in Visual Studio Code.
See the extension in action in our video.
To use this extension, you must have a valid Understand license. Try it for free with a trial license. Students and teachers can get a free educational license. Please see available options at scitools.com/pricing.
Understand by SciTools | C/C++ by Microsoft | clangd by LLVM | C/C++ Advanced Lint by Joseph Benden | |
---|---|---|---|---|
Supports more than C/C++ | Yes | No | No | No |
Can analyze whole project | Yes | Yes | No | No |
See all errors/warnings at launch | Yes | No | No | No |
Definitions and other references | Yes | Yes | Yes | No |
Hover for arguments, type, etc. | Yes | Yes | Yes | No |
AUTOSAR, MISRA, CERT, etc. | Yes | No | No | Yes |
Companion GUI application | Yes | No | No | No |
See or Go To References
See Hover Information
See Errors and Warnings
Quickly Analyze Your Code
Explore in Understand
Understand Different Languages
Install Understand, which comes with UServer, the Understand language server
Open Visual Studio Code and install this extension, if you haven't already
Using at least 1 source code file, create a project in Understand, resulting in a .und folder. With this extension, you can simply create a source code file and run the command "Understand: Explore in Understand: New Project" to quickly get started.
If you want to see violations from CodeCheck, make your CodeCheck configuration(s) run in the background
In Visual Studio Code, open a folder/workspace that contains the .und folder. Also, include all of the source code files that you want.
userver
.Why is the language server executable not found?
Make the command userver
accessible to Visual Studio Code
understand.server.executable
to your userver path like /your/path/to/userver
userver
to the PATH
environment variable
~/.profile
file, add export PATH="/your/path/to:$PATH"
where /your/path/to
is the parent directory of userver
sudo ln -s /your/path/to/userver /usr/bin
sudo mkdir -p /usr/local/bin && sudo ln -s /your/path/to/userver /usr/local/bin
Why isn't the language server starting?
Make sure that you have a .und folder in your file explorer, which is created automatically when creating an Understand project.
Why aren't my results accurate after creating or deleting a file?
If your project uses compile_commands.json, then you must build after creating or deleting files.
Now that I am connected to the Understand language server, how do I use it?
Command Palette:
workbench.action.showCommands
and type in Understand to see all of the commands available to you.Status Bar:
Code Actions:
Editor Context Menu:
Why don't I see some commands in certain files?
If a file isn't a resolved project file, then the file-specific commands won't show up in the command palette. The other commands - general and project-specific - should still be available.
Why don't I see certain kinds of references, like declarations, type definitions, or implementations?
- It might be because the token doesn't have an entity, like a number literal or a keyword.
- An entity may not have the reference kind that you are looking for. For example, in C, an
int
object doesn't have a type definition because it's a primitive type, but astruct
object does if the type is resolved.- Some languages don't have certain reference kinds. For example, C doesn't have implementations, but Java does.
Why don't violations go away after manually fixing them?
- You should analyze after manually fixing an error or warning.
How do I see the name of a violation?
Do any of the following
// Example keybindings: Commands that start with "Understand: Violations: Go to"
{
"key": "f8",
"command": "understand.violations.goToNextViolationInCurrentFile",
"when": "editorTextFocus",
},
{
"key": "shift+f8",
"command": "understand.violations.goToPreviousViolationInCurrentFile",
"when": "editorTextFocus",
},
// Example keybinding: "Show or Focus Hover" command (this also shows the detailed description)
{
"key": "shift+space",
"command": "editor.action.showHover",
"when": "editorTextFocus",
},
How do I skip certain violations with the "Go to Next/Previous Violation" commands?
How do I have more control over showing/focusing on the violations (Problems panel)?
In keybindings.json, try different keybindings like the following. Read more about the "when" property and running multiple commands.
// Example keybinding: Show violations and focus on violations, but close when it's focused
{
"key": "alt+v",
"command": "understand.violations.toggleVisibilityAndFocus",
},
// Example keybinding: When in the editor, show violations but keep focus on the editor
{
"key": "alt+v",
"command": "runCommands",
"when": "editorFocus && activePanel != 'workbench.panel.markers'",
"args": {
"commands": [
"understand.violations.toggleVisibilityAndFocus",
"workbench.action.focusLastEditorGroup",
],
}
},
// Example keybinding: When in the editor, close violations from the editor
{
"key": "alt+v",
"command": "runCommands",
"when": "editorFocus && activePanel == 'workbench.panel.markers'",
"args": {
"commands": [
"understand.violations.toggleVisibilityAndFocus",
"understand.violations.toggleVisibilityAndFocus",
"workbench.action.focusLastEditorGroup",
],
}
},
// Example keybinding: When in the violations panel, focus on the editor
{
"key": "alt+v",
"when": "panelFocus && activePanel == 'workbench.panel.markers'",
"command": "workbench.action.focusLastEditorGroup",
},
// Example keybinding: When in the violations panel, close it
{
"key": "escape",
"when": "panelFocus && activePanel == 'workbench.panel.markers'",
"command": "understand.violations.toggleVisibilityAndFocus",
},
How do I change the colors of violations?
In settings.json, the colors can be changed. This is especially useful for color blind users
{
// See all color customizations:
// https://code.visualstudio.com/api/references/theme-color
"workbench.colorCustomizations": {
// Editor squiggles and problems panel
"editorWarning.foreground": "#ffff77",
"editorError.foreground": "#ff7777",
// File name color
"list.warningForeground": "#ffff77",
"list.errorForeground": "#ff7777"
}
}