python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

No documentation about turning on pylint

Open technillogue opened this issue 6 years ago • 3 comments

It's highly unclear how to enable pylint (and disable pyflakes, flake8, etc).

technillogue avatar Jul 01 '19 17:07 technillogue

@technillogue Here's my settings section from a .sublime-project file

"settings": {
    "LSP": {
      "pyls": {
        "command": ["/Users/myuser/.virtualenvs/theenv/bin/pyls"],
        "enabled": true,
        "languageId": "python",
        "scopes": ["source.python"],
        "env": {
          "PYTHONPATH": "/Users/myuser/.virtualenvs/theenv/lib/python3.7/site-packages",
          "PATH": "$PATH:/Users/myuser/.virtualenvs/theenv/bin"
        },
        "settings": {
          "pyls": {
            "configurationSources": ["flake8"],
            "plugins": {
              "yapf": {
                "enabled": true
              },
              "pyflakes": {
                "enabled": false
              },
              "mccabe": {
                "enabled": false
              },
              "flake8": {
                "enabled": true
              }
            }
          }
        },
        "syntaxes": ["Packages/Python/Python.sublime-syntax"]
      }
    },
    "python_interpreter": "/Users/myuser/.virtualenvs/theenv/bin/python",
    "python_package_paths": [
      "$project_path/agent",
      "$home/.virtualenvs/theenv/lib/python3.7"
    ],
    ...snip
  }

You can add a "pylint" section in the plugins object and turn it on. Don't forget to install python-language-server[pylint] as well.

Note also the "env" section, adding the /bin directory to PATH is crucial for the plugins to be able to find their respective commands. I had this issue with flake8 where everything was configured correctly but the implementation was trying to run flake8 or python -m flake8 both of which were failing because they were not found in the plugins environment.

One more trick that helped me a lot in debugging these issues is to change the command for running pyls to the follwoing:

"command": ["/Users/myuser/.virtualenvs/theenv/bin/pyls", "-vv", "--log-file=/tmp/lsp.log"]

Create the /tmp/lsp.log file and restart the pyls server after making these changes. This will enable really verbose logging from the pyls server into that log file and let you see why plugin execution is failing/working.

ckm2k1 avatar Jan 27 '20 14:01 ckm2k1

Hi,

Sorry to bump this thread.

What about other editors? Are there any configuration files specific to pyls?

I am trying to get pylint active using LanguageClient-neovim. According to another issue over here, there exist a workspace specific json file to control server settings, but I can't get it to work.

robertsawko avatar Mar 17 '20 13:03 robertsawko

I find the documentation also rather lacking. Pylint isn't even mentioned in the README.

astier avatar Aug 03 '20 14:08 astier