Reputation: 356
I'm using Visual Studio Code (Version 1.8.1) on Linux. When there is a build error and I click on the line that contains the error it doesn't jump to the corresponding line in the code. Is there a way to make Visual Studio Code behave the same as standard Visual Studio?
Upvotes: 17
Views: 15991
Reputation: 51
You can quickly jump to the error in your code by using the shortcut of Ctrl + shift + M
Upvotes: 2
Reputation: 9970
Using a vanilla install of Visual Studio Code and the Microsoft C++ plugin, after building a simple CMake project by hitting <F7>
with the default keybinding for that key, <CTRL-LEFT_MOUSE>
works great to navigate to the line of an error from the TERMINAL tab. Note the errors in the OUTPUT window are not clickable.
Errors in this tab are clickable:
Errors in this tab are not clickable:
Upvotes: 1
Reputation: 112
Did you build your code in TERMINAL window of Visual Studio Code? If so, press down the "Ctrl" key and move the mouse cursor to the filename and line number such as "/home/..../xxx.cpp:123" in the error line, then you can click on it to jump to the corresponding line in the code
It works for me.
Upvotes: 7
Reputation: 34138
Have you defined a problem matcher in your tasks.json
? There are several built-in ones that can simply be referenced, for instance "problemMatcher": ["$tsc"]
will work for TypeScript.
The docs also contain an example for a custom problem matcher for C++:
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
If there's no built-in matcher for the language you're using, you shoulds still be able to find one with a bit of searching if it's moderately popular.
Upvotes: 10