我使用 Vim/gVim 在 javascript (node) 中进行编程。我在我的文件类型插件中将 jslint 连接为 makeprg。这是错误格式:
efm=%-P%f,
\%A%>%\\s%\\?#%*\\d\ %m,%Z%.%#Line\ %l\\,\ Pos\ %c,
\%-G%f\ is\ OK.,%-Q
这是 jslint 的输出:
routes/pcr.js
#1 'db' was used before it was defined.
db.collection('pcrs', function (err, collection) { // Line 11, Pos 5
#2 'db' was used before it was defined.
db.collection('pcrs', function (err, collection) { // Line 23, Pos 5
#3 'BSON' was used before it was defined.
collection.findOne({'_id': new BSON.ObjectID(id)}, function (err, item) { // Line 24, Pos 40
这是快速修复窗口的输出:
routes/pcr.js|11 col 5| 'db' was used before it was defined.
routes/pcr.js|23 col 5| 'db' was used before it was defined.
routes/pcr.js|24 col 40| 'BSON' was used before it was defined.
在列号之后,我想将其保留为 2 位数字(我希望文件的错误不超过 99 个!),使其看起来像:
routes/pcr.js|11 col 5| 'db' was used before it was defined.
routes/pcr.js|23 col 5| 'db' was used before it was defined.
routes/pcr.js|24 col 40| 'BSON' was used before it was defined.
我想这也会影响行号 0-9。是否可以有条件地填充输出?