SublimeLinter / SublimeLinter

The code linting framework for Sublime Text
https://www.sublimelinter.com/
MIT License
2.01k stars 269 forks source link

Confused about configuring with S4 #1253

Closed reagle closed 6 years ago

reagle commented 6 years ago

Since SL4 was pushed to packagecontrol my linting is fubar.

  1. Via package control I have Sublinter-pycodestyle and Sublinter-contrib-write-good installed.
  2. I think my settings file might have been moved to SublimeLinter (old).sublime-settings file in ~/Library/Application Support/Sublime Text 3; so I started with a new SublimeLinter.sublime-settings.
  3. No matter what I put into it, it seems like pycodestyle and write-good are active, even if "@disable": true,. I no longer seem to have an option for toggling specific linters on and off via command palette.
  4. I've checked the documentation, but I don't see answers to my questions:

    • Is SL4 configuring differently than SL3? How to transition?
    • Where are user settings supposed to go?
    • How does one enable/disable linters for specific file types?
braver commented 6 years ago

We did a lot of messaging about this, but you probably missed all of it. Some reading material:

https://github.com/SublimeLinter/SublimeLinter/blob/master/messages/4.0.0.txt

https://forum.sublimetext.com/t/sublimelinter-4-beta/34022/37

Where are user settings supposed to go?

The defaults on the left show lot's of info here. You just copy them over and adjust, if you need to change something. Same as with every other package.

How does one enable/disable linters for specific file types?

https://github.com/SublimeLinter/SublimeLinter/blob/master/docs/linter_settings.rst

reagle commented 6 years ago

@braver, thanks for the links, 4.0.0.txt was helpful. I think I have the basics working now, except I have some toggle and gutter issues.

  1. When using writegood I don't want anything in the gutter. Can I set this?
  2. When I use writegood, I'd like to quickly toggle the linter on and off. This is no longer possible?
  3. When I use pycodestyles, I want to see indicators in the gutter, but nothing is there. SL4 shows me the problems in the panel, and highlights the problematic code, but there's nothing in the gutter. (I also run git gutter.)

Have a set something wrong?

{
    "debug": false,
    "delay": 0.25,
    "gutter_theme": "Default",
    "lint_mode": "background",
    "linters":
    {
        "pycodestyle":
        {
            "disable": false,
            "args": [],
            "excludes": [],
            "ignore": ["E124", "E241", "W503", "E701"],
            "max-line-length": null,
            "selector": "source.python"
        },
        "writegood":
        {
            "disable": false,
            "args": ["--no-adverb", "--no-weasel",],
            "selector": "text.html.markdown",
            "excludes": [],
        }
    },
    "no_column_highlights_line": false,
    "paths":
    {
        "linux": [],
        "osx": [],
        "windows": []
    },
    "show_marks_in_minimap": true,
    "syntax_map":
    {
        "html (django)": "html",
        "html (rails)": "html",
        "html 5": "html",
        "javascript (babel)": "javascript",
        "magicpython": "python",
        "php": "html",
        "python django": "python",
        "pythonimproved": "python"
    },
}
braver commented 6 years ago

Those settings look reasonable.

When using writegood I don't want anything in the gutter. Can I set this?

You add styles for that linter and set the icon to "none":

"writegood": {
    "styles": [
        {
            "scope": "",
            "priority": 0,
            "icon": "none",
            "types": ["error", "warning"]
        },
    ]
}

When I use writegood, I'd like to quickly toggle the linter on and off. This is no longer possible?

No, we don't have that yet. We will introduce a "save" only mode that only runs on save. There is a command "Toggle Highlights" that removes the highlighting. So it will run in the background, but if you want to check the errors you can quickly toggle the highlights on and off.

When I use pycodestyles, I want to see indicators in the gutter, but nothing is there.

Perhaps start by removing settings that simply reflect the defaults:

"debug": false,
"delay": 0.25,
"gutter_theme": "Default",
"lint_mode": "background",
"show_marks_in_minimap": true,
"no_column_highlights_line": false,
    "paths":
    {
        "linux": [],
        "osx": [],
        "windows": []
    },
    "show_marks_in_minimap": true,
    "syntax_map":
    {
        "html (django)": "html",
        "html (rails)": "html",
        "html 5": "html",
        "javascript (babel)": "javascript",
        "magicpython": "python",
        "php": "html",
        "python django": "python",
        "pythonimproved": "python"
    },

There is no need to have them set in your file and not having them will save your trouble later.

Then, I'd like to know the color scheme you're using and perhaps see a screenshot of those missing icons. We should be able to figure out what's what.

kaste commented 6 years ago

I have

{ "keys": ["ctrl+k", "ctrl+k"],
    "command": "sublime_linter_toggle_highlights"
},

and it's đź‘Ť

FichteFoll commented 6 years ago

That should probably be referenced in the default bindings? Not as being active but at least in a comment.

reagle commented 6 years ago

Thanks for the suggestions. My simplified version is:

{
    "linters":
    {
        "pycodestyle":
        {
            "disable": false,
            "args": [],
            "excludes": [],
            "ignore": ["E124", "E241", "W503", "E701"],
            "max-line-length": null,
            "selector": "source.python"
        },
        "writegood":
        {
            "disable": false,
            "args": ["--no-adverb", "--no-weasel",],
            "selector": "text.html.markdown",
            "excludes": [],
            "styles": [
                {
                    "scope": "",
                    "priority": 0,
                    "icon": "none",
                    "types": ["error", "warning"]
                },
            ]
        }
    },
}
reagle commented 6 years ago

For write-good, "icon": "none" does disable the gutter as requested, however, I don't see highlights...?

screen shot 2018-03-20 at 5 51 19 pm
reagle commented 6 years ago

I have a different problem with pycodestyles. As you can see, I have a highlight at line 1341, but not gutter, which I also want. (The gutter shows parens when my line is on it, but even if I move off that line, there's nothing in the gutter.)

screen shot 2018-03-20 at 5 53 36 pm
braver commented 6 years ago

Just to take that out of the equation, can you try with the monokai color scheme?

braver commented 6 years ago

Oh, those squirlies in the second screenshot aren’t from SublimeLinter but probably from the spell checker.

reagle commented 6 years ago

The icon in the gutter on the 2nd is from parenthesis matching.

reagle commented 6 years ago

Removing the color scheme from my preferences restores the gutter icon in python and highlights in markdown. It looks like I don't have to modify color schemes anymore to get them to work with SL, but is there a list of schemes that are known to work? (If I understand correctly.)

braver commented 6 years ago

Also, probably the brackethighlighter plugin is overriding our icons, and it doesn’t seem to have config to stop it from doing that (Gitgutter does).

All default color schemes work. If you use ST dev releases all color schemes work. If you use something else, you may need to tweak he styles setting: https://github.com/SublimeLinter/SublimeLinter/blob/master/docs/settings.rst#styles-colors

reagle commented 6 years ago

Okay, thanks for the help!