error - atom插件频繁报错,怎么关闭错误信息提示?

查看:337
本文介绍了error - atom插件频繁报错,怎么关闭错误信息提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

atom + atom-beautify 保存文件的时候自动格式化,插件总是报错,弹出红色的错误提示框。
这个错误已经被提交了,下个版本修复。

请问如何暂时关闭插件的错误提示?

解决方案

一个暴力的方法是看下相关的报错信息,找到报错的插件的代码,然后将报错的代码注释之。比如,我遇到的这个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修复了再开启,要不就找个替代的插件。

这篇关于error - atom插件频繁报错,怎么关闭错误信息提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆