I have the jslint installed with npm on my system.
It produces error messages in the following format:
1 1,9: Missing name in function statement.
function() {
2 2,11: Use '===' to compare with '0'.
if (x == 0) {
3 4,2: Unnecessary semicolon.
};
I wrote a compiler plugin for Vim to parse the error messages, but I could not figure out the problem with the errorformat
. I have the following now in my compiler file:
CompilerSet makeprg=jslint
\\ $*
\\ %
CompilerSet errorformat=
\%*[\ ]%n\ %l\,%c:\ %m,
\%-G%.%#
Which AFAIK should do the following:
%*[\ ]
-- skip the whitespaces in the beginning of the line%n
-- match the error number\
-- skip a space%l
-- match for the line number\,
-- skip the comma%c
-- match the column number:
-- skip the colon\
-- skip the space again%m
-- match the error message,
-- new line%-G%.%#
-- skip all the othersIt runs the jslint
which shows the messages but the :clist
command does not show any errors.
What am I missing?
The problem was with the \,
, the skip comma, the correct format is:
CompilerSet errorformat=
\%*[\ ]%n\ %l%.%c:\ %m,
\%-G%.%#