Sublime Forum

How do I switch between linters

#1

hello,

I installed two linter for the same scope selector. How can I toggle between these two to lint a file using the context menu or sublime menu? Right now, both are active.

Edit: I know I can disable one in the configuration with disable: true. A couple of years ago I was able to switch between linter from the context menu, but a lot has changed for SublimeLinter.

0 Likes

#2

You trigger an event (by editing or by calling the “lint this view” command) and SublimeLinter runs all linters that are configured for that type of file. You can manage which linters are active via settings, and you can have settings globally and per project. Settings in SublimeText are evaluated per view, so you can set “temporary” settings that only exist as long as the view exists. This way you can disable a linter temporarily.

So, if for one project you need one linter, and for another something else, use project settings.

If you need to toggle linters on the fly, create commands to do so.

The settings keys you’re looking for are for like:
"SublimeLinter.linters.flake8.disable"
… so the package key and then the path to the setting you want to change. This also works for most other packages.

A command could trigger something like this:
sublime.active_window().active_view().settings().set("SublimeLinter.linters.flake8.disable", True)

You can find more information on commands and project settings in the SublimeText documentation.

0 Likes