palantir / python-language-server

An implementation of the Language Server Protocol for Python
MIT License
2.6k stars 282 forks source link

Sublime cannot change plugin settings? #839

Closed adehad closed 3 years ago

adehad commented 3 years ago

Using python-language-server==0.34.1 installed via pip install 'python-language-server[all]' (Python 3.8) on Windows 10 1909 and following the instructions here: https://lsp.readthedocs.io/en/latest/#python

I have the following set in my project config:

    "settings":
    {
        "LSP": {
          "pyls": {
            "configurationSources": ["flake8"],
            "command": ["C:/virtualenvs/linter38/Scripts/pyls"], //
            "enabled": true, // if you want to enable Python Language Server for current project only
            "env": {
              // it needs to be an absolute path, neither $HOME nor ~ work here
              "PYTHONPATH": "C:/virtualenvs/analysis38/Lib/site-packages"
            },
            "plugins": {
                "pycodestyle": {
                    "enabled": false,
                    "ignore": [  // Ignore errors and warnings
                        "E501",  // Line too long (82 > 79 characters)
                      ],
                    "maxLineLength": 88,
                },
                "pydocstyle": {"enabled": false},
                "pyflakes": {"enabled": false},
                "pylint": {"enabled": false},
                "yapf": {"enabled": false},
                "flake8_lint" : {"enabled": true},
            },
          }
        }
    }

I can confirm that these are passed to pyls in some form: Ctrl+`:

LSP: window has override for pyls {'configurationSources': ['flake8'], 'enabled': True, 'env': {'PYTHONPATH': 'C:/virtualenvs/analysis38/Lib/site-packages'}, 'plugins': {'flake8_lint': {'enabled': True}, 'yapf': {'enabled': False}, 'pylint': {'enabled': False}, 'pycodestyle': {'ignore': ['E501'], 'maxLineLength': 88, 'enabled': False}, 'pyflakes': {'enabled': False}, 'pydocstyle': {'enabled': False}}, 'command': ['C:/virtualenvs/linter38/Scripts/pyls']}

But my .py files are still using pycodestyle despite being disabled. I have additionally tried changing the settings of pycodestyle but equally no luck it getting those to affect the linting displayed.

The other pyls features work well, and it just seems that the plugin configurations are not being applied?

bicobus commented 3 years ago

Hello, your configuration is erroneous. The plugin settings must be in an embedded sub "settings" section.

"settings":
    {
        "LSP":
        {
            "pyls":
            {
                "configurationSources": ["flake8"],
                "command": ["C:/virtualenvs/linter38/Scripts/pyls"],
                "enabled": true,
                "env": {
                    "PYTHONPATH": "C:/virtualenvs/analysis38/Lib/site-packages"
                },
                "settings": {
                    "pyls": {
                        "plugins": {
                            "pycodestyle": {
                                "enabled": false,
                                "ignore": [ 
                                    "E501", 
                                ],
                                "maxLineLength": 88,
                            },
                            "pydocstyle": {"enabled": false},
                            "pyflakes": {"enabled": false},
                            "pylint": {"enabled": false},
                            "yapf": {"enabled": false},
                            "flake8_lint" : {"enabled": true},
                        },
                    }
                }
            }
        }
    }
ccordoba12 commented 3 years ago

Closing then because this is not something that can be solved here.