summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-07 14:10:47 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-07 14:10:47 +0200
commite928366de5deca359fad779a4f740db703296302 (patch)
tree7612c416d5cf7d0d9915ff61cc88d4360d3e2096
parent975a880a1389e8ce6dea8d66a7c109140b2f94ec (diff)
downloadvim-git-e928366de5deca359fad779a4f740db703296302.tar.gz
patch 8.2.0917: quickfix entries do not suport a "note" typev8.2.0917
Problem: Quickfix entries do not suport a "note" type. Solution: Add support for "note". (partly by Yegappan Lakshmanan, closes #5527, closes #6216)
-rw-r--r--runtime/doc/quickfix.txt7
-rw-r--r--src/quickfix.c11
-rw-r--r--src/testdir/test_quickfix.vim30
-rw-r--r--src/version.c2
4 files changed, 46 insertions, 4 deletions
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index d4ebf5c48..9c1b7d557 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1375,7 +1375,11 @@ Basic items
%v virtual column number (finds a number representing
screen column of the error (1 <tab> == 8 screen
columns))
- %t error type (finds a single character)
+ %t error type (finds a single character):
+ e - error message
+ w - warning message
+ i - info message
+ n - note message
%n error number (finds a number)
%m error message (finds a string)
%r matches the "rest" of a single-line file message %O/P/Q
@@ -1446,6 +1450,7 @@ prefixes are:
%E start of a multi-line error message
%W start of a multi-line warning message
%I start of a multi-line informational message
+ %N start of a multi-line note message
%A start of a multi-line message (unspecified type)
%> for next line start with current pattern again |efm-%>|
%C continuation of a multi-line message
diff --git a/src/quickfix.c b/src/quickfix.c
index acd28a143..b4ecaad32 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -133,6 +133,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
@@ -371,7 +372,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
{
@@ -1166,7 +1167,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;
@@ -1439,7 +1440,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
@@ -3880,11 +3881,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
@@ -3900,6 +3903,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)
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index fb4e07c6f..96729a4e9 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1347,6 +1347,36 @@ func Test_efm2()
let &efm = save_efm
endfunc
+" Test for '%t' (error type) field in 'efm'
+func Test_efm_error_type()
+ let save_efm = &efm
+
+ " error type
+ set efm=%f:%l:%t:%m
+ cexpr ["Xfile1:10:E:msg1", "Xfile1:20:W:msg2", "Xfile1:30:I:msg3",
+ \ "Xfile1:40:N:msg4", "Xfile1:50:R:msg5"]
+ let output = split(execute('clist'), "\n")
+ call assert_equal([
+ \ ' 1 Xfile1:10 error: msg1',
+ \ ' 2 Xfile1:20 warning: msg2',
+ \ ' 3 Xfile1:30 info: msg3',
+ \ ' 4 Xfile1:40 note: msg4',
+ \ ' 5 Xfile1:50 R: msg5'], output)
+
+ " error type and a error number
+ set efm=%f:%l:%t:%n:%m
+ cexpr ["Xfile1:10:E:2:msg1", "Xfile1:20:W:4:msg2", "Xfile1:30:I:6:msg3",
+ \ "Xfile1:40:N:8:msg4", "Xfile1:50:R:3:msg5"]
+ let output = split(execute('clist'), "\n")
+ call assert_equal([
+ \ ' 1 Xfile1:10 error 2: msg1',
+ \ ' 2 Xfile1:20 warning 4: msg2',
+ \ ' 3 Xfile1:30 info 6: msg3',
+ \ ' 4 Xfile1:40 note 8: msg4',
+ \ ' 5 Xfile1:50 R 3: msg5'], output)
+ let &efm = save_efm
+endfunc
+
func XquickfixChangedByAutocmd(cchar)
call s:setup_commands(a:cchar)
if a:cchar == 'c'
diff --git a/src/version.c b/src/version.c
index 6466000f5..3ef0a9b90 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 917,
+/**/
916,
/**/
915,