Sublime Forum

Config ST with LSP-pylsp

#1

Hi,

I followed this article on how to setup ST with LSP-pylsp. I have two issues:

Issues

I get double warning for each error, one from Flake8 and the other for Pycodestyle despite the fact that I setup to only trigger Flake8

My setup

I have a ST project configured with to work with a virtual env managed by Poetry.

LSP Settings :

{
    "clients": {
        "pylsp": {
            "enabled": false,
            "selector": "source.python",
            "settings": {
                "pylsp.plugins.pyflakes.enabled": false, 
                "pylsp.plugins.pycodestyle.enabled": false, 
                "pylsp.plugins.flake8.enabled": true, 
                "pylsp.configurationSources": ["flake8"],
                "pylsp.plugins.jedi_rename.enabled": true,
                "pylsp.plugins.autopep8.enabled": false,  
                "pylsp.plugins.yapf.enabled": false,  
                "pylsp.plugins.black.enabled": true, 
                "pylsp.plugins.mypy_ls.enabled": true
}}}}

Py-lsp settings :

{
    "pylsp.plugins.mypy-ls.enabled": true,
    "pylsp.plugins.flake8.enabled": true,
    "pylsp.configurationSources": [ "flake8"],
    "pylsp.plugins.pyls_black.enabled": true,
}

Sublime Project settings

{
    "folders": [
        {
            "path": ".",
        },
    ],
    "settings": {
        "python_interpreter": "/Users/me/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/python3",
        "LSP": {
            "pylsp": {
                "enabled": true,
                "command": [
                    "/Users/me/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/pylsp",
                ],
                "settings": {
                    "pylsp.plugins.flake8.executable": "~/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/flake8",
                },
            },
        },
    },
    "build_systems": [
        {
            "name": "Base Python Build",
            "cmd": [
                "/Users/me/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/python3",
                "-u",
                "$file"
            ],
            "selector": "source.python",
            "file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)",
        }
    ],
}

Do you have any advices on how to setup this correctly ?

0 Likes