VS Code,更改如何显示Flake8警告/错误

huangapple go评论60阅读模式
英文:

VS Code, changing how Flake8 warnings/errors are displayer

问题

I started using VS Code for Python development, and I'm trying to figure out how to configure Flake8 properly.

我开始使用VS Code进行Python开发,我正在尝试弄清楚如何正确配置Flake8。

I installed the extension:

我安装了这个扩展:

And I wanted to configure it so that all the problems detected by it are indicated by a yellow squiggly line.

我想配置它,以便它检测到的所有问题都会用黄色的波浪线表示。

I added the following lines to my user settings (on MacOS, the file in Users/my_user_name/Library/Application Support/Code/User/settings.json):

我将以下行添加到我的用户设置中(在MacOS上,文件位于Users/my_user_name/Library/Application Support/Code/User/settings.json):

"python.linting.flake8CategorySeverity.E": "Warning",
"python.linting.flake8CategorySeverity.F": "Warning",
"python.linting.flake8CategorySeverity.W": "Warning",

but it's still highlighting warning and errors differently:

但它仍然以不同的方式突出显示警告和错误:

I don't know if this is possible in the first place, but I have the feeling the lines regarding flake8 are being ignored...I tried adding

我不知道这是否首先可能,但我有一种感觉与flake8有关的这些行被忽略了...我尝试添加

"python.linting.enabled": false,
"python.linting.flake8Enabled": false,

but the problems are still being highlighted, the only way to avoid it seems to be disabling the extension altogether.

但问题仍然被突出显示,似乎唯一的避免方法是完全禁用扩展。

My workspace setting file is empty, so nothing should be overwriting the user settings, right?

我的工作区设置文件为空,因此不应该覆盖用户设置,对吗?

英文:

I started using VS Code for Python development, and I'm trying to figure out how to configure Flake8 properly.

I installed the extension:

VS Code,更改如何显示Flake8警告/错误

And I wanted to configure it so that all the problems detected by it are indicated by a yellow squiggly line.
I added the following lines to my user settings (on MacOS, the file in Users/my_user_name/Library/Application Support/Code/User/settings.json):

"python.linting.flake8CategorySeverity.E": "Warning",
"python.linting.flake8CategorySeverity.F": "Warning",
"python.linting.flake8CategorySeverity.W": "Warning",

but it's still highlighting warning and errors differently:

VS Code,更改如何显示Flake8警告/错误

I don't know if this is possible in the first place, but I have the feeling the lines regarding flake8 are being ignored...I tried adding

"python.linting.enabled": false,
"python.linting.flake8Enabled": false,

but the problems are still being highlighted, the only way to avoid it seems to be disabling the extension altogether.

My workspace setting file is empty, so nothing should be overwriting the user settings, right?

答案1

得分: 3

扩展特定的设置应该被使用:

"flake8.severity": {
"E": "警告",
"F": "警告",
"I": "信息",
"W": "警告"
}

可用的设置在扩展描述中列出。

英文:

Extension specific settings should be used:

"flake8.severity": {
    "E": "Warning",
    "F": "Warning",
    "I": "Information",
    "W": "Warning"
}

Available settings are listed in extension description.

huangapple
  • 本文由 发表于 2023年5月25日 15:31:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76329859.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定