Closed xaizek closed 2 years ago
I cannot modify it currently, because all xmake IDE and editor plugins (vscode, vsxmake, sublime, idea ..), as well as third-party plugins (qt creator, vs ..), already rely on the current output format to parse the error output. If I modify it, they will all be broken.
But you can add a custom theme in ~/.xmake/themes/mytheme.lua
(copy https://github.com/xmake-io/xmake/blob/master/xmake/themes/default/xmake.lua and modify it)
Modify default error prefix text:
theme("mytheme")
-- ...
set_text("error", "Custom Error Output:\n")
then switch to your theme
xmake g --theme=mytheme
What's the rationale for the current format? Was it really necessary to do it this way and should I try to handle it in Vim? I imagine it made things harder for all of the plugins or maybe it resolves some ambiguity?
Didn't know about themes, will give it a try.
At present, all official xmake plugins and third-party plugins have been supported, only the error:
prefix needs to be parsed, which is not complicated.
Thanks but with
set_text("error", "")
I still get leading ": ":
[ 10%]: ccache compiling.debug src/main.cpp
: src/main.cpp:304:60: error: no match for ‘operator|’ (operand types are ‘uint64_t’ {aka ‘long unsigned int’} and ‘std::optional<long unsigned int>’)
so themes can't address this.
Solved it in Vim with:
let &errorformat = 'error: %f:%l:%c:%m,'.&errorformat
Still think its a weird thing to prepend.
It would be a good and harmless fix to remove xmake prefix when the text is empty. ex:
set_text("error", "prefix")
=>
[ 10%]: ccache compiling.debug src/main.cpp
prefix: src/main.cpp:304:60: error:
set_text("error", "")
=>
[ 10%]: ccache compiling.debug src/main.cpp
src/main.cpp:304:60: error:
Describe the bug
Output of build systems are often processed to find errors. Errors are identified by looking for
error:
,note:
,warning:
, etc. and part of the line to the left of it is taken to be a path. xmake adds "error: " prefix on the first line which breaks extraction of file name for the first error. That's very annoying as it makes Vim look for a file that doesn't exist.Expected behavior
I think "error: " should just be printed on its own line. Maybe make it more verbose like "External command has failed with the output:", because currently it can be mistaken for part of command's output.
Error output
Related Environment
xmake v2.6.2 (v.2.5.9 behaved the same)