mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-patch:8.2.0917: quickfix entries do not suport a "note" type
Problem: Quickfix entries do not suport a "note" type.
Solution: Add support for "note". (partly by Yegappan Lakshmanan,
closes vim/vim#5527, closes vim/vim#6216)
e928366de5
This commit is contained in:
@@ -1330,7 +1330,11 @@ Basic items
|
|||||||
%v virtual column number (finds a number representing
|
%v virtual column number (finds a number representing
|
||||||
screen column of the error (1 <tab> == 8 screen
|
screen column of the error (1 <tab> == 8 screen
|
||||||
columns))
|
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)
|
%n error number (finds a number)
|
||||||
%m error message (finds a string)
|
%m error message (finds a string)
|
||||||
%r matches the "rest" of a single-line file message %O/P/Q
|
%r matches the "rest" of a single-line file message %O/P/Q
|
||||||
@@ -1401,6 +1405,7 @@ prefixes are:
|
|||||||
%E start of a multi-line error message
|
%E start of a multi-line error message
|
||||||
%W start of a multi-line warning message
|
%W start of a multi-line warning message
|
||||||
%I start of a multi-line informational 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)
|
%A start of a multi-line message (unspecified type)
|
||||||
%> for next line start with current pattern again |efm-%>|
|
%> for next line start with current pattern again |efm-%>|
|
||||||
%C continuation of a multi-line message
|
%C continuation of a multi-line message
|
||||||
|
@@ -143,6 +143,7 @@ struct efm_S {
|
|||||||
// 'E' error message
|
// 'E' error message
|
||||||
// 'W' warning message
|
// 'W' warning message
|
||||||
// 'I' informational message
|
// 'I' informational message
|
||||||
|
// 'N' note message
|
||||||
// 'C' continuation line
|
// 'C' continuation line
|
||||||
// 'Z' end of multi-line message
|
// 'Z' end of multi-line message
|
||||||
// 'G' general, unspecific message
|
// 'G' general, unspecific message
|
||||||
@@ -457,7 +458,7 @@ static const char_u *efm_analyze_prefix(const char_u *efmp, efm_T *efminfo,
|
|||||||
if (vim_strchr((char_u *)"+-", *efmp) != NULL) {
|
if (vim_strchr((char_u *)"+-", *efmp) != NULL) {
|
||||||
efminfo->flags = *efmp++;
|
efminfo->flags = *efmp++;
|
||||||
}
|
}
|
||||||
if (vim_strchr((char_u *)"DXAEWICZGOPQ", *efmp) != NULL) {
|
if (vim_strchr((char_u *)"DXAEWINCZGOPQ", *efmp) != NULL) {
|
||||||
efminfo->prefix = *efmp;
|
efminfo->prefix = *efmp;
|
||||||
} else {
|
} else {
|
||||||
snprintf((char *)errmsg, errmsglen,
|
snprintf((char *)errmsg, errmsglen,
|
||||||
@@ -967,7 +968,7 @@ restofline:
|
|||||||
fmt_start = fmt_ptr;
|
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_multiline = true; // start of a multi-line message
|
||||||
qfl->qf_multiignore = false; // reset continuation
|
qfl->qf_multiignore = false; // reset continuation
|
||||||
} else if (vim_strchr((char_u *)"CZ", idx) != NULL) {
|
} else if (vim_strchr((char_u *)"CZ", idx) != NULL) {
|
||||||
@@ -1499,7 +1500,7 @@ static int qf_parse_match(char_u *linebuf, size_t linelen, efm_T *fmt_ptr,
|
|||||||
if ((idx == 'C' || idx == 'Z') && !qf_multiline) {
|
if ((idx == 'C' || idx == 'Z') && !qf_multiline) {
|
||||||
return QF_FAIL;
|
return QF_FAIL;
|
||||||
}
|
}
|
||||||
if (vim_strchr((char_u *)"EWI", idx) != NULL) {
|
if (vim_strchr((char_u *)"EWIN", idx) != NULL) {
|
||||||
fields->type = idx;
|
fields->type = idx;
|
||||||
} else {
|
} else {
|
||||||
fields->type = 0;
|
fields->type = 0;
|
||||||
@@ -3432,11 +3433,13 @@ bool qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount,
|
|||||||
// e or E 0 " error"
|
// e or E 0 " error"
|
||||||
// w or W 0 " warning"
|
// w or W 0 " warning"
|
||||||
// i or I 0 " info"
|
// i or I 0 " info"
|
||||||
|
// n or N 0 " note"
|
||||||
// 0 0 ""
|
// 0 0 ""
|
||||||
// other 0 " c"
|
// other 0 " c"
|
||||||
// e or E n " error n"
|
// e or E n " error n"
|
||||||
// w or W n " warning n"
|
// w or W n " warning n"
|
||||||
// i or I n " info n"
|
// i or I n " info n"
|
||||||
|
// n or N n " note n"
|
||||||
// 0 n " error n"
|
// 0 n " error n"
|
||||||
// other n " c n"
|
// other n " c n"
|
||||||
// 1 x "" :helpgrep
|
// 1 x "" :helpgrep
|
||||||
@@ -3446,15 +3449,17 @@ static char_u *qf_types(int c, int nr)
|
|||||||
static char_u cc[3];
|
static char_u cc[3];
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
if (c == 'W' || c == 'w')
|
if (c == 'W' || c == 'w') {
|
||||||
p = (char_u *)" warning";
|
p = (char_u *)" warning";
|
||||||
else if (c == 'I' || c == 'i')
|
} else if (c == 'I' || c == 'i') {
|
||||||
p = (char_u *)" info";
|
p = (char_u *)" info";
|
||||||
else if (c == 'E' || c == 'e' || (c == 0 && nr > 0))
|
} else if (c == 'N' || c == 'n') {
|
||||||
|
p = (char_u *)" note";
|
||||||
|
} else if (c == 'E' || c == 'e' || (c == 0 && nr > 0)) {
|
||||||
p = (char_u *)" error";
|
p = (char_u *)" error";
|
||||||
else if (c == 0 || c == 1)
|
} else if (c == 0 || c == 1) {
|
||||||
p = (char_u *)"";
|
p = (char_u *)"";
|
||||||
else {
|
} else {
|
||||||
cc[0] = ' ';
|
cc[0] = ' ';
|
||||||
cc[1] = (char_u)c;
|
cc[1] = (char_u)c;
|
||||||
cc[2] = NUL;
|
cc[2] = NUL;
|
||||||
|
@@ -1260,6 +1260,36 @@ func Test_efm2()
|
|||||||
let &efm = save_efm
|
let &efm = save_efm
|
||||||
endfunc
|
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)
|
func XquickfixChangedByAutocmd(cchar)
|
||||||
call s:setup_commands(a:cchar)
|
call s:setup_commands(a:cchar)
|
||||||
if a:cchar == 'c'
|
if a:cchar == 'c'
|
||||||
|
Reference in New Issue
Block a user