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?
-
1Not an answer to the question, but alt-F8 will quickly take you to the next error, at least it does for TypeScript.Theodore Norvell– Theodore Norvell2019-04-09 15:33:52 +00:00Commented Apr 9, 2019 at 15:33
-
alt-f8 ?? it seem to do something, but 1) alt-f8 is not a keystoke that allows anything 'quickly', since I cant press that left-handed 2) it seems to cycle through 3 of to 6 problems in my case, not sure whyJan Wilmans– Jan Wilmans2020-01-06 08:28:11 +00:00Commented Jan 6, 2020 at 8:28
4 Answers
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.
Comments
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.
8 Comments
You can quickly jump to the error in your code by using the shortcut of Ctrl + shift + M
1 Comment
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.

