Is your feature request related something that is currently hard to do? Please describe.
Given the fact that it is impossible to format quickfix output at the moment, yes.
Describe the solution you'd like
In the same way as how quickfix renders %t=w as warning and %t=e as error,
%t=n should render as note. (Further extensions to this might be needed, eg %t=r rendering as remark)
Describe alternatives you've considered
Could use a manual formatter as outlined in #4425 (comment)
Haven't yet managed to make these work yet, however.
Additional context
This could probably be solved by #4425.
In any case, more documentation on the behavior of %t is needed - the documentation only notes that %t matches a single character, not how it's rendered.
Had to discover the behaviour in the %t=w, %t=e by experimentation.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Currently the quickfix window only renders warning, error and info. This is hard-coded inside the following function. It is indeed not documented very well. But you can get a hint under :help errorformat-multi-line. It lists only three multi-line messages: error, warning and informational.
It would be nice if notes was a recognized error type, considering how many compilers (including gcc and clang) use note messages instead of info. Microsoft's Language Server Protocol also adds a fourth diagnostic type hint (see DiagnosticSeverity). So it probably wouldn't hurt if we had a fourth error type as well.
The following patch adds a fourth error type note to the quickfix window and a new prefix %N for multi-line note messages:
diff --git a/src/quickfix.c b/src/quickfix.c index 7ae489b5..c0258f57 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -132,6 +132,7 @@ struct efm_S // 'E' error message // 'W' warning message // 'I' informational message + // 'N' note message // 'C' continuation line // 'Z' end of multi-line message // 'G' general, unspecific message @@ -370,7 +371,7 @@ efm_analyze_prefix(char_u *efmp, efm_T *efminfo) { if (vim_strchr((char_u *)"+-", *efmp) != NULL) efminfo->flags = *efmp++; - if (vim_strchr((char_u *)"DXAEWICZGOPQ", *efmp) != NULL) + if (vim_strchr((char_u *)"DXAEWINCZGOPQ", *efmp) != NULL) efminfo->prefix = *efmp; else { @@ -1165,7 +1166,7 @@ qf_parse_match( if ((idx == 'C' || idx == 'Z') && !qf_multiline) return QF_FAIL; - if (vim_strchr((char_u *)"EWI", idx) != NULL) + if (vim_strchr((char_u *)"EWIN", idx) != NULL) fields->type = idx; else fields->type = 0; @@ -1438,7 +1439,7 @@ restofline: if (fmt_ptr->conthere) fmt_start = fmt_ptr; - if (vim_strchr((char_u *)"AEWI", idx) != NULL) + if (vim_strchr((char_u *)"AEWIN", idx) != NULL) { qfl->qf_multiline = TRUE; // start of a multi-line message qfl->qf_multiignore = FALSE;// reset continuation @@ -3874,11 +3875,13 @@ qf_mark_adjust( * e or E 0 " error" * w or W 0 " warning" * i or I 0 " info" + * n or N 0 " note" * 0 0 "" * other 0 " c" * e or E n " error n" * w or W n " warning n" * i or I n " info n" + * n or N n " note n" * 0 n " error n" * other n " c n" * 1 x "" :helpgrep @@ -3894,6 +3897,8 @@ qf_types(int c, int nr) p = (char_u *)" warning"; else if (c == 'I' || c == 'i') p = (char_u *)" info"; + else if (c == 'N' || c == 'n') + p = (char_u *)" note"; else if (c == 'E' || c == 'e' || (c == 0 && nr > 0)) p = (char_u *)" error"; else if (c == 0 || c == 1)
I have tested it very quickly and it seems to work. Maybe someone who knows the quickfix.c file very well could take a look at it.
Still awaiting a test for this. Ideally, can someone turn this into a pull request?
—
You are receiving this because you commented.
Still awaiting a test for this. Ideally, can someone turn this into a pull request?