python - 让 SublimeLinter 显示错误代码
问题描述
如果我flake8
在终端运行,它会为每个错误提供字母数字错误代码 - 例如 F401 用于未使用的导入:
$ flake8 ~/test.py
/Users/markamery/test.py:1:1: F401 'math' imported but unused
但是,当我在 Sublime 中使用SublimeLinter-flake8对代码进行 lint 时,这些代码不包含在状态栏中显示的错误消息中:
如何使错误代码出现在状态托盘中,就像它们在终端上一样?
解决方案
SublimeLinter 的设置文件现在包含一个消息模板参数,默认只显示错误消息,在默认设置文件中记录如下:
// Show the messages for problems at your cursor position.
// - {message} will be replaced by the actual messages.
// - {linter} will be replaced by the linter reporting the error.
// - {type} will be replaced by either warning or error.
// - {code} will be replaced by the error code.
// Set to "" to display nothing
"statusbar.messages_template": "{message}",
那么,要显示错误代码,您需要:
推荐阅读
- php - 使用 PHP 进行 Aweber 集成
- c# - 如何比较两个 24Points 游戏表达式?
- swift - Swift NSRegularExpression 太贪心了
- elasticsearch - 弹性搜索 grok 过滤器
- mysql - Hibernate创建没有关系表的关系
- android - Volley to Retrofit2 - 如何使用 Retrofit2 进行字符串请求?
- javascript - 我成功构建了我的应用程序,但是当我运行它时,它崩溃了,这是我的 logcat 中提示的味精
- c# - ASP.NET C# OData 服务 + 导航属性 + $expand = null。我错过了什么?
- select - Erlang Mnesia select on an ordered_set 是否给出了 Erlang Term 顺序的列表?
- jquery - 如何使用 jQuery 按两列对表格进行排序?