一个暴力的方法是看下相关的报错信息,找到报错的插件的代码,然后将报错的代码注释之。比如,我遇到的这个linter-phpcs插件,在写php时总是报这个错,我忍了它很久:
然后我百度了下,就看到楼主也在问atom插件报错的问题,实在不想忍了,就找到了插件源码的文件夹,找到报错的main.js文件,定位到报错的相关代码:
return messages.map((message) => {
// fix column in line with tabs
let { line, column } = message;
line -= 1;
const lineText = textEditor.getBuffer().lineForRow(line);
if (lineText.includes('\t')) {
column = fixPHPCSColumn(lineText, line, column);
}
column -= 1;
let range;
try {
range = helpers.rangeFromLineNumber(textEditor, line, column);
} catch (e) {
// eslint-disable-next-line no-console
console.error(
'linter-phpcs:: Invalid point encountered in the attached message',
{
message,
source: {
lineLength: lineText.length,
lineText,
},
}
);
throw Error('Invalid point encountered! See console for details.');
}
然后将其中console.error()这段注释掉,就不再报错了。
console.error(
'linter-phpcs:: Invalid point encountered in the attached message',
{
message,
source: {
lineLength: lineText.length,
lineText,
},
}
);
ps:实在不行就暂时关掉插件吧,等bug修复了再开启,要不就找个替代的插件。