Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appears to not be doing anything #7

Open
tolomea opened this issue Aug 2, 2021 · 8 comments
Open

Appears to not be doing anything #7

tolomea opened this issue Aug 2, 2021 · 8 comments

Comments

@tolomea
Copy link

tolomea commented Aug 2, 2021

I have Sublime 4113 on Ubuntu Xenial, with Package Control 3.4.1.
I have sublack installed and working correctly (black 21.5b0).
I have SublimeLinter-flake8 installed and working correctly (flake8 3.9.2 with a bunch of plugins, SublimeLinter 4.17.0, SublimeLlinter-flake8 4.2.4).
These are both using the same 3.8.10 venv.
Predictably at this point I'm a bit irritated by flake8 complaining about the stuff black will fix on save.
So I installed this addon (0.2.4) which looks perfect, but it didn't do anything.
I'm not that familiar with Sublime internals so I've no idea where to start on debugging.
Do you have any suggestions or pointers?

@tolomea
Copy link
Author

tolomea commented Aug 2, 2021

I am seeing this in the console

SublimeLinter: WARNING: Executing `pipenv --venv` failed
  [Errno 2] No such file or directory: 'pipenv'

@tolomea
Copy link
Author

tolomea commented Aug 2, 2021

I think I fixed that by adding a python setting to the flake8 linter section, addon still seems to not work

@kaste
Copy link
Owner

kaste commented Aug 2, 2021

As just installing is not enough, did you enable this plugin as described in the README? Which method did you use?

@tolomea
Copy link
Author

tolomea commented Aug 2, 2021

Sorry, I was unclear maybe, or I'm confused, black on save is working fine

@kaste
Copy link
Owner

kaste commented Aug 2, 2021

Iirc there are tons of methods to configure sublack but here I - out of the box - only read one setting namely 'sublack.black_on_save'. Often set in the project file.

There are workarounds iirc but that's why I'm asking.

@tolomea
Copy link
Author

tolomea commented Aug 3, 2021

sublack package settings

{
      "black_command": "/home/gordon/venv/black/bin/black",
      "black_on_save": true
}

sublime linter package settings

{
    "linters": {
        "flake8": {
            "@disable": false,
            "args": [],
            "builtins": "",
            "excludes": [],
            "ignore": "",
            "max-complexity": 10000,
            "max-line-length": null,
            "select": "",
            "python": "/home/gordon/venv/black/bin/python"
        }
    },
    "paths": {
        "linux": ["/home/gordon/venv/black/bin"],
        "osx": [],
        "windows": []
    }
}

SublimeLinter-addon-black-for-flake settings

{
}

There is nothing about sublack or sublime linter in the project settings or the main user settings
Does that help?

I tried adding it to the project settings but that didn't change anything.

Is there some way maybe on the console that I can test what the plugin will be seeing?

@kaste
Copy link
Owner

kaste commented Aug 3, 2021

With these settings alone, this plugin will not "kick-in". If you set "sublack.black_on_save": true in the project settings, you can get this back, e.g. confirm it, in the console

> view.settings().get("sublack.black_on_save")

(view is the current view. Maybe check view.file_name().)

@kaste
Copy link
Owner

kaste commented Aug 3, 2021

Generally, you could debug by installing it manually. Just git clone this package into Sublime's Packages folder, the meat of it is in

def blacked_find_errors(self, output):
if should_auto_config(self.view):
return [
error
for error in super_fn(self, output)
if (error.error or error.warning) not in BLACK_FIXABLES
]
return super_fn(self, output)

Here you can test if if should_auto_config(self.view): matches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants