4

我在 SublimeText3 中为 SublimeLinter 设置用户设置时遇到了困难。我在这里检查过:http: //www.sublimelinter.com/en/latest/settings.html

我尝试设置我的用户设置,并将“max-line-length”设置为 80(默认值为 100):

{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "linters": {
            "pylint": {
                "@disable": false,
                "args": [],
                "disable": "",
                "enable": "",
                "excludes": [],
                "max-line-length": 80,
                "paths": [],
                "rcfile": "",
                "show-codes": false
            }
        },
        "mark_style": "outline",
        "no_column_highlights_line": true,
        "passive_warnings": false,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "php": "html",
            "python django": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

但是,不应用此设置。我已经关闭并重新打开了崇高的文本。如何应用此设置?谢谢。

4

2 回答 2

10

您使用的语法似乎适用于某些linter,但是,据我所知,它不适用于pylint

无论如何,要使用Sublime Text中的pylint您可以使用命令参数--max-line-length=N,所以更改

"args": []

为了

"args": ["--max-line-length=90"]

此外,如果您这样做,请删除max-line-length属性。


编辑:放置 SublimeLinter 设置的位置。

您可以在SublimeLinter 设置文档中了解它

我使用了 user-settings-file,您通常可以使用以下菜单选项找到该文件:Preferences > Package Settings > SublimeLinter > Settings-User。为此,您需要在linters/pylint中添加选项:

{
    "user": {
        "linters": {
            "pylint": {
                // "exampleOtion": "exampleValue",
                "args": ["--max-line-length=90"]
            }
        }
    }
}

请注意,您的配置文件可能与问题中的类似,因此您只需在“pylint”中添加新选项而不会破坏 JSON 格式

于 2014-12-27T18:01:51.693 回答
0

由于此消息继续定期出现在 Google 的首页上,并且 SublimeLinter 发生了很大变化,这是我的解决方案:

我在 sublime text 3(screenshot )的命令面板中输入“pref lint”或“preferences linter”以打开首选项文件。

这是SublimeLinter.sublime-settings我正在使用的默认配置文件(W0312用于使用制表符而不是空格):

// SublimeLinter Settings - User
{
    "linters": {
        "pylint": {
            "filter_errors": ["warning:", "W0312"]
        }
    }
}

我使用pylint-messages在搜索框的帮助下找到正确的错误/警告代码。

于 2019-06-11T15:20:58.663 回答