Hi, On Mon, Feb 24, 2020 at 5:39 PM bfrg <[email protected]> wrote:
> Currently the quickfix window only renders warning, error and info. This > is hard-coded inside the following function > <https://github.com/vim/vim/blob/e010c720b2024d8c6df45c60c6001c3b4f157de1/src/quickfix.c#L3871-L3914>. > 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 > <https://microsoft.github.io/language-server-protocol/specifications/specification-current/#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. > > > The patch looks good to me. Can you add some tests for this change? Regards, Yegappan -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7nPEv8SZdYjWXLPvk%3DqdTBvq_WeKY9co3723VJvc_N6Ww%40mail.gmail.com.
