Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errorformat is incorrect #97

Open
jasoneveleth opened this issue Jun 27, 2023 · 2 comments
Open

errorformat is incorrect #97

jasoneveleth opened this issue Jun 27, 2023 · 2 comments

Comments

@jasoneveleth
Copy link

jasoneveleth commented Jun 27, 2023

This plugin doesn't set the errorformat, and so multiline failures like:

/home/jason/src/my-language/src/main.zig:359:22: error: unable to resolve inferred error set
    try readDelimited(ps, ')');
        ~~~~~~~~~~~~~^~~~~~~~~
referenced by:
    macros: /home/jason/src/my-language/src/main.zig:218:20
    read: /home/jason/src/my-language/src/main.zig:494:41
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Don't get interpreted properly. I propose a different errorformat (and I would like to make a pull request). Here is my new errorformat:

"    macros: /home/jason/src/my-language/src/main.zig:218:20
set efm=\ \ \ \ %m:\ %f:%l:%c
"/home/jason/src/my-language/src/main.zig:359:22: error: unable to resolve inferred error set
set efm+=%f:%l:%c:\ %t%.%#:\ %m
"[matches anything]
set efm+=%C%m
rudedogg added a commit to rudedogg/zig.vim that referenced this issue Sep 14, 2023
@owallb
Copy link

owallb commented May 6, 2024

Nice! You may also want to consider adding %-G%.%#. As I understand, it will match anything else and ignore it. It is useful when there are compile time prints or similar, because it will otherwise parse the error numbers incorrectly.

For example, the following has only 1 error but is marked as error 307 (out of 316):

:set efm?
  errorformat=%f:%l:%c: %t%.%#: %m
:make
<316 lines truncated>
(307 of 316) error: expected type 'type', found 'error{Unreachable,EatenByAGrue}'
:clist
307 exercises/058_quiz7.zig:312 col 84 error: expected type 'type', found 'error{Unreachable,EatenByAGrue}'

With %-G%.%# it will instead be 1:

:set efm?
  errorformat=%f:%l:%c: %t%.%#: %m,%-G%.%#
:make
<316 lines truncated>
(1 of 1) error: expected type 'type', found 'error{Unreachable,EatenByAGrue}'
:clist
 1 exercises/058_quiz7.zig:312 col 84 error: expected type 'type', found 'error{Unreachable,EatenByAGrue}'

@xz47sv
Copy link

xz47sv commented Jun 18, 2024

This plugin doesn't set the errorformat, and so multiline failures like:

/home/jason/src/my-language/src/main.zig:359:22: error: unable to resolve inferred error set
    try readDelimited(ps, ')');
        ~~~~~~~~~~~~~^~~~~~~~~
referenced by:
    macros: /home/jason/src/my-language/src/main.zig:218:20
    read: /home/jason/src/my-language/src/main.zig:494:41
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Don't get interpreted properly. I propose a different errorformat (and I would like to make a pull request). Here is my new errorformat:

"    macros: /home/jason/src/my-language/src/main.zig:218:20
set efm=\ \ \ \ %m:\ %f:%l:%c
"/home/jason/src/my-language/src/main.zig:359:22: error: unable to resolve inferred error set
set efm+=%f:%l:%c:\ %t%.%#:\ %m
"[matches anything]
set efm+=%C%m

The %.%#: should be replaced with %*[^:]:, i.e. %f:%l:%c:\ %t%*[^:]:\ %m, because %.%# is greedy and if there is more than one : it will skip them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants