python-language-server
python-language-server copied to clipboard
Support Flake8 plugins and configuration
Can I use flake8 tool for linting? I looked in package.json, but did not find there the corresponding options.
if I change configurationSources
to ['flake'], then I do not see any changes and pyflakes
continues to be used. I store flake8
settings in .flake8
file for all projects.
If this is important, I use lsp-mode in Emacs and LanguageClient-neovim in Neovim as clients.
So you need to set configurationSources
to ['flake8']
. Then we will parse your flake8 config and pass the equivalent settings into pycodestyle and pyflakes. We don't use flake8 directly.
I try it and nothing changed. This option parse .flake8
file?
I have a .flake8
file with this content
[flake8]
ignore = E501, E265, F811
max-line-length = 160
But I still get errors about the length of the line of more than 79 characters. A similar problem if the file is named flake8.cfg
.
Why not use flake8 directly (as optional feature, for example)? I use some flake8-plugins, for example, flake8-isort
and flake8-pdb
and pyls
do not work with them
The reasoning is that there are lots of tools for python linting, and to avoid keeping up with all of them, we would just integrate with the core set of tools that actually do the lifting. These being pycodestyle, pydocstyle, pyflakes, pylint etc.
Aggregation tools, such as flake8, pylama etc. tend to add lots of duplication.
However, you raise a very good point around plugins for these tools, as well as the complexity we now have to deal with around configuration options. I'll give it a think, but it may just be easier to provide plugins for these tools and then allow the user to enable/disable plugins to get their preferred set of tools.
@gatesn If I'm installed python-language-server via pypi where do I change configurationSources
?
Depends which client you’re using?
From: purpleP [email protected] Sent: Wednesday, January 10, 2018 8:39:40 AM To: palantir/python-language-server Cc: Nicholas Gates; Mention Subject: Re: [palantir/python-language-server] Flake8 linting (#190)
@gatesnhttps://github.com/gatesn If I'm installed python-language-server via pypi where do I change configurationSources
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/palantir/python-language-server/issues/190#issuecomment-356536358, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AB1rdOR7H10C8b_75Ky-8oJ-LEScOI6cks5tJHdMgaJpZM4QczKr.
@gatesn neovim language server.
I think you'll have to take a look at this: https://github.com/autozimu/LanguageClient-neovim/issues/139
@gatesn
Is this how my settings.json
should look like? I still can see errors that should be ignored.
{
"pyls": {
"configurationSources": "['flake8']" # I've tried ["flake8"] etc
}
}
@purpleP I still can't seem to reproduce this issue. Can you pass -vvv
to the pyls
command and then upload the log output? Warning it will contain the source code of any file you open
Hi, I'm not sure if I'm having the same issue, but it sounds similar. In my situation, changing the max-line-length
in my flake8 config does actually work, but it seems that the ignore
option is ignored. I'm getting some pycodestyle
warnings for things I've got in my flake8 ignore
list, and my configuration seems to be loaded correctly based on the logs with -vvv
.
For example:
2018-08-08 00:58:11,210 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pycodestyle': {'select': ['B', 'C', 'E', 'F', 'W', 'T4', 'B9'], 'maxLineLength': 90, 'ignore': ['E203', 'E266', 'E501', 'W503']}, 'pydocstyle': {'enabled': False}}, 'configurationSources': ['flake8']}
2018-08-08 00:58:11,210 UTC - DEBUG - pyls.plugins.mccabe_lint - Running mccabe lint with threshold: 15
2018-08-08 00:58:11,215 UTC - DEBUG - pyls.config.config - finish pyls_lint --> [[], [{'source': 'pycodestyle', 'range': {'start': {'line': 181, 'character': 90}, 'end': {'line': 181, 'character': 94}}, 'message': 'E501 line too long (93 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 203, 'character': 90}, 'end': {'line': 203, 'character': 93}}, 'message': 'E501 line too long (92 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 210, 'character': 90}, 'end': {'line': 210, 'character': 92}}, 'message': 'E501 line too long (91 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 379, 'character': 90}, 'end': {'line': 379, 'character': 92}}, 'message': 'E501 line too long (91 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 390, 'character': 57}, 'end': {'line': 390, 'character': 61}}, 'message': "E203 whitespace before ':'", 'code': 'E203', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 396, 'character': 47}, 'end': {'line': 396, 'character': 52}}, 'message': "E203 whitespace before ':'", 'code': 'E203', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 420, 'character': 90}, 'end': {'line': 420, 'character': 95}}, 'message': 'E501 line too long (94 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 421, 'character': 90}, 'end': {'line': 421, 'character': 92}}, 'message': 'E501 line too long (91 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 471, 'character': 90}, 'end': {'line': 471, 'character': 95}}, 'message': 'E501 line too long (94 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 472, 'character': 90}, 'end': {'line': 472, 'character': 92}}, 'message': 'E501 line too long (91 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 538, 'character': 16}, 'end': {'line': 538, 'character': 61}}, 'message': 'W503 line break before binary operator', 'code': 'W503', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 563, 'character': 90}, 'end': {'line': 563, 'character': 92}}, 'message': 'E501 line too long (91 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 628, 'character': 90}, 'end': {'line': 628, 'character': 92}}, 'message': 'E501 line too long (91 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 629, 'character': 90}, 'end': {'line': 629, 'character': 93}}, 'message': 'E501 line too long (92 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 631, 'character': 90}, 'end': {'line': 631, 'character': 93}}, 'message': 'E501 line too long (92 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 632, 'character': 90}, 'end': {'line': 632, 'character': 98}}, 'message': 'E501 line too long (97 > 90 characters)', 'code': 'E501', 'severity': 2}, {'source': 'pycodestyle', 'range': {'start': {'line': 634, 'character': 90}, 'end': {'line': 634, 'character': 92}}, 'message': 'E501 line too long (91 > 90 characters)', 'code': 'E501', 'severity': 2}], []] [hook]
EDIT: Got this to work. I had to set g:LanguageClient_settingsPath
.
@gatesn what is the default value for this variable? If I don't set it, it doesn't appear to be set, and the documentation says the default is ".vim/settings.json"
. To where is this relative path relative? Does this mean the default is ~/.vim/settings.json
? Thanks in advance!
Leaving the below for context
@purpleP @gatesn did you get this to work? My LanguageClient_neovim seems unable to pick up the setting to look at the [flake8]
section of my project's setup.cfg
file. This is the output of pyls -vvv
:
2018-09-01 21:45:53,799 UTC - INFO - pyls.python_ls - Starting PythonLanguageServer IO language server
2018-09-01 21:45:53,800 UTC - DEBUG - pyls.jsonrpc.endpoint - Handling request from client {'jsonrpc': '2.0', 'method': 'initialize', 'params': {'capabilities': {'textDocument': {'completion': {'completionItem': {'snippetSupport': True}}}, 'workspace': {'applyEdit': True, 'didChangeWatchedFiles': {'dynamicRegistration': True}}}, 'processId': 18448, 'rootPath': '/Users/mattgoldberg/testapp', 'rootUri': 'file:///Users/mattgoldberg/testapp', 'trace': 'off'}, 'id': 9}
2018-09-01 21:45:53,800 UTC - DEBUG - pyls.python_ls - Language server initialized with 18448 file:///Users/mattgoldberg/testapp /Users/mattgoldberg/testapp None
2018-09-01 21:45:53,972 UTC - INFO - pyls.config.config - Loaded pyls plugin autopep8 from <module 'pyls.plugins.autopep8_format' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/autopep8_format.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_completion from <module 'pyls.plugins.jedi_completion' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/jedi_completion.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_definition from <module 'pyls.plugins.definition' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/definition.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_highlight from <module 'pyls.plugins.highlight' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/highlight.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_hover from <module 'pyls.plugins.hover' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/hover.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_references from <module 'pyls.plugins.references' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/references.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_signature_help from <module 'pyls.plugins.signature' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/signature.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_symbols from <module 'pyls.plugins.symbols' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/symbols.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin mccabe from <module 'pyls.plugins.mccabe_lint' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/mccabe_lint.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin pycodestyle from <module 'pyls.plugins.pycodestyle_lint' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/pycodestyle_lint.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin pydocstyle from <module 'pyls.plugins.pydocstyle_lint' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/pydocstyle_lint.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin pyflakes from <module 'pyls.plugins.pyflakes_lint' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/pyflakes_lint.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin rope_completion from <module 'pyls.plugins.rope_completion' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/rope_completion.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin rope_rename from <module 'pyls.plugins.rope_rename' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/rope_rename.py'>
2018-09-01 21:45:53,973 UTC - INFO - pyls.config.config - Loaded pyls plugin yapf from <module 'pyls.plugins.yapf_format' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/yapf_format.py'>
2018-09-01 21:45:53,974 UTC - DEBUG - pyls.config.config - pyls_settings [hook]
config: <pyls.config.config.Config object at 0x103ddb780>
2018-09-01 21:45:53,974 UTC - DEBUG - pyls.config.config - finish pyls_settings --> [{'plugins': {'rope_completion': {'enabled': False}}}, {'plugins': {'pydocstyle': {'enabled': False}}}] [hook]
2018-09-01 21:45:53,974 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,974 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,974 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,974 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,974 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,975 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,976 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,977 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,978 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,979 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,980 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,981 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,982 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,983 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - Got user config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - With user configuration: {}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - With plugin configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - With lsp configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.source - Using cached configuration for ('/Users/mattgoldberg/testapp/setup.cfg',)
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-01 21:45:53,984 UTC - DEBUG - pyls.config.config - With project configuration: {'plugins': {'rope_completion': {'enabled': False}, 'pydocstyle': {'enabled': False}}}
2018-09-01 21:45:53,984 UTC - INFO - pyls.config.config - Disabled plugins: [<module 'pyls.plugins.pydocstyle_lint' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/pydocstyle_lint.py'>, <module 'pyls.plugins.rope_completion' from '/Users/mattgoldberg/.pyenv/versions/3.7.0/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyls/plugins/rope_completion.py'>]
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - pyls_dispatchers [hook]
config: <pyls.config.config.Config object at 0x103ddb780>
workspace: <pyls.workspace.Workspace object at 0x103ddb748>
document: None
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - finish pyls_dispatchers --> [] [hook]
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - pyls_initialize [hook]
config: <pyls.config.config.Config object at 0x103ddb780>
workspace: <pyls.workspace.Workspace object at 0x103ddb748>
document: None
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - finish pyls_initialize --> [] [hook]
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - pyls_commands [hook]
config: <pyls.config.config.Config object at 0x103ddb780>
workspace: <pyls.workspace.Workspace object at 0x103ddb748>
document: None
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - finish pyls_commands --> [] [hook]
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - pyls_experimental_capabilities [hook]
config: <pyls.config.config.Config object at 0x103ddb780>
workspace: <pyls.workspace.Workspace object at 0x103ddb748>
document: None
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.config.config - finish pyls_experimental_capabilities --> [] [hook]
2018-09-01 21:45:53,985 UTC - INFO - pyls.python_ls - Server capabilities: {'codeActionProvider': True, 'codeLensProvider': {'resolveProvider': False}, 'completionProvider': {'resolveProvider': False, 'triggerCharacters': ['.']}, 'documentFormattingProvider': True, 'documentHighlightProvider': True, 'documentRangeFormattingProvider': True, 'documentSymbolProvider': True, 'definitionProvider': True, 'executeCommandProvider': {'commands': []}, 'hoverProvider': True, 'referencesProvider': True, 'renameProvider': True, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'textDocumentSync': 2, 'experimental': {}}
2018-09-01 21:45:53,985 UTC - DEBUG - pyls.jsonrpc.endpoint - Got result from synchronous request handler: {'capabilities': {'codeActionProvider': True, 'codeLensProvider': {'resolveProvider': False}, 'completionProvider': {'resolveProvider': False, 'triggerCharacters': ['.']}, 'documentFormattingProvider': True, 'documentHighlightProvider': True, 'documentRangeFormattingProvider': True, 'documentSymbolProvider': True, 'definitionProvider': True, 'executeCommandProvider': {'commands': []}, 'hoverProvider': True, 'referencesProvider': True, 'renameProvider': True, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'textDocumentSync': 2, 'experimental': {}}}
2018-09-01 21:45:53,988 UTC - DEBUG - pyls.jsonrpc.endpoint - Handling notification from client {'jsonrpc': '2.0', 'method': 'initialized', 'params': {}}
2018-09-01 21:45:53,989 UTC - DEBUG - pyls.jsonrpc.endpoint - Handling notification from client {'jsonrpc': '2.0', 'method': 'textDocument/didOpen', 'params': {'textDocument': {'languageId': 'python', 'text': '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\n', 'uri': 'file:///Users/mattgoldberg/testapp/test.py', 'version': 0}}}
2018-09-01 21:45:53,990 UTC - DEBUG - pyls.config.config - pyls_document_did_open [hook]
config: <pyls.config.config.Config object at 0x103ddb780>
workspace: <pyls.workspace.Workspace object at 0x103ddb748>
document: file:///Users/mattgoldberg/testapp/test.py
2018-09-01 21:45:53,990 UTC - DEBUG - pyls.config.config - finish pyls_document_did_open --> [] [hook]
2018-09-01 21:45:54,387 UTC - DEBUG - pyls.jsonrpc.endpoint - Handling notification from client {'jsonrpc': '2.0', 'method': 'exit', 'params': None}
This is my setup.cfg
:
[yapf]
based_on_style = pep8
column_limit = 100
blank_line_before_nested_class_or_def = true
space_between_ending_comma_and_closing_bracket = false
[isort]
line_length = 100
[flake8]
max-line-length = 100
exclude = .git, .venv, build, dist
This is my $HOME/.vim/settings.json
:
{
"pyls.configurationSources": ["flake8"]
}
I also tried this:
{
"pyls": {
"configurationSources": ["flake8"]
}
}
Neither of these worked, is one of them supposed to?
This is my dummy script test.py
(giving a [Warning][E501]E501 line too long (90 > 79 characters)
message):
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
I am using LanguageClient-neovim too and wanted to disable the linting so I set the variable to [] but like op I don't see any change.
{
"pyls": {
"configurationSources": []
},
"languageServerHaskell": {
"hlintOn": false,
"maxNumberOfProblems": 10
},
"initializationOptions": {
"cacheDirectory": "/tmp/cquery"
}
}
Does anyone have a working .vim/settings.json for Neovim's LanguageClient_Neovim I could have?
I've been trying all night trying to get it to respect my ~/.config/flake8 all i want is for it to ignore docstrings.
I've done some testing with this as well. My LanguageClient-neovim settings.json
contents looks like:
{
"pyls": {
"plugins": {
"pycodestyle": {
"enabled": true,
"ignore": [
"E501"
],
"select": [
"C",
"E",
"F",
"W",
"B",
"B950"
]
}
},
"configurationSources": [
"pycodestyle",
"flake8"
]
}
}
And I have it configured to run pyls -vv
and point the server logs to /tmp/LanguageClient-server.log
. Looking at the log, I can see that the settings.json
configuration "works" in that it is loaded by pyls
:
2018-09-25 00:46:36,057 UTC - DEBUG - pyls.jsonrpc.endpoint - Handling notification from client {'jsonrpc': '2.0', 'method': 'workspace/didChangeConfiguration', 'params': {'settings': {'pyls': {'configurationSources': ['pycodestyle', 'flake8'], 'plugins': {'pycodestyle': {'enabled': True, 'ignore': ['E501'], 'select': ['C', 'E', 'F', 'W', 'B', 'B950']}}}, 'solargraph': {'diagnostics': True}}}}
2018-09-25 00:46:36,057 UTC - INFO - pyls.config.config - Updated settings to {'configurationSources': ['pycodestyle', 'flake8'], 'plugins': {'pycodestyle': {'enabled': True, 'ignore': ['E501'], 'select': ['C', 'E', 'F', 'W', 'B', 'B950']}}}
But then the value of the ignore
setting appears to be itself ignored later on:
2018-09-25 00:46:44,256 UTC - DEBUG - pyls.config.source - Using cached configuration for ()
2018-09-25 00:46:44,256 UTC - DEBUG - pyls.config.config - Got project config from PyCodeStyleConfig: {}
2018-09-25 00:46:44,256 UTC - DEBUG - pyls.config.config - With project configuration: {'configurationSources': ['pycodestyle', 'flake8'], 'plugins': {'pycodestyle': {'enabled': True, 'ignore': ['E501'], 'select': ['C', 'E', 'F', 'W', 'B', 'B950']}, 'pydocstyle': {'enabled': False}, 'rope_completion': {'enabled': False}}}
2018-09-25 00:46:44,256 UTC - DEBUG - pyls.plugins.mccabe_lint - Running mccabe lint with threshold: 15
2018-09-25 00:46:44,256 UTC - DEBUG - pyls.config.config - finish pyls_lint --> [[], [{'source': 'pycodestyle', 'range': {'start': {'line': 0, 'character': 79}, 'end': {'line': 0, 'character': 86}}, 'message': 'E501 line too long (85 > 79 characters)', 'code': 'E501', 'severity': 2}], []] [hook]
2018-09-25 00:46:44,256 UTC - DEBUG - pyls.jsonrpc.endpoint - Sending notification: textDocument/publishDiagnostics {'uri': 'file:///home/shados/test.py', 'diagnostics': [{'source': 'pycodestyle', 'range': {'start': {'line': 0, 'character': 79}, 'end': {'line': 0, 'character': 86}}, 'message': 'E501 line too long (85 > 79 characters)', 'code': 'E501', 'severity': 2}]}
On the other hand, if I remove the select
setting and just have:
{
"pyls": {
"plugins": {
"pycodestyle": {
"enabled": true,
"ignore": [
"E501"
]
}
},
"configurationSources": [
"pycodestyle",
"flake8"
]
}
}
Then it works just fine. So I played around with it some more:
- If I have another ignore set in
~/.config/flake8
, it gets loaded asuser config from Flake8Config
, but anyignore
s set in it are ignored in favour of the ones set in mysettings.vim
. - If I instead have another ignore set in
.flake8
in the project directory, it gets loaded asproject config from Flake8Config
, and itsignore
s are used, but anyignore
s set in mysettings.vim
are ignored.
It appears that:
- Setting
select
(a whitelist of violations to show) completely disablesignore
(a blacklist of the same). - 'project config' overrides 'lsp config', which in turn overrides 'user config'.
This behaviour is fairly different to flake8
's own behaviour:
- The 'most specific' applicable
ignore
orselect
rule for any given violation is the one that applies. - Project configuration is merged on top of user configuration, by default.
And also partly different to pycodestyle
's behaviour:
- Project configuration is merged on top of user configuration, by default.
Conclusion
I believe there are two problems:
- The method
pyls
is using to merge and pass configuration options topycodestyle
is broken, in that it does not respect the default behaviour of merging project configuration on top of user configuration -- it just outright overrides options set in the latter. -
pyls
is attempting to passflake8
options through topycodestyle
directly, even though the semantics of them are somewhat different. There's actually a larger problem here: the strategy of callingpycodestyle
directly whenflake8
configuration is being used is fundamentally broken, because offlake8
's support for plugins. To avoid confusion,pyls
needs to either supportflake8
directly (in addition topycodestyle
), or not at all.
For now, I'll just disable pyls
linting and use it only for the various jedi
functionality, with ale calling flake8
for linting.
Thanks for the awesome report @Shados . I have a perfectly fine ~/.config/pycodestyle/config I would very much love to be respected by pyls. Corssing fingers for a fix.
I created a quick-and-dirty pyls plugin called pyls-flake8.
Once you install it with pip, I set the pyls config to disable pyflakes and pycodestyle, restarted the server, and voila.
@emanspeaks python2 support...?
However, you raise a very good point around plugins for these tools, as well as the complexity we now have to deal with around configuration options. I'll give it a think, but it may just be easier to provide plugins for these tools and then allow the user to enable/disable plugins to get their preferred set of tools.
Can we expect support for flake8 plugins in the near future?
I'm a sublime user, but I had the same issue as OP, .flake8 config file not being picked up. I was able to get it working with this config setup:
"LSP": {
"pyls": {
"syntaxes": ["Packages/Python/Python.sublime-syntax", "Packages/Djaneiro/Syntaxes/Python Django.tmLanguage"],
"command": ["/Users/my_user/.virtualenvs/webappv2/bin/pyls"],
"enabled": true,
"scopes": ["source.python"],
"settings": {
"pyls": {
"configurationSources": ["flake8"],
"plugins": {
"autopep8": {
"enabled": false
},
"yapf": {
"enabled": false
}
}
}
},
}
}
The main trick was adding the nested "pyls" prop inside the "settings" dictionary. Hope this helps someone.
PS -- I was also forced to restart the language server on every change to this config. I'm not sure why it's the case but it might prevent false negatives when testing the config with your own editor.
@Shados:
For now, I'll just disable
pyls
linting and use it only for the variousjedi
functionality, with ale callingflake8
for linting.
I'm looking to do this as well. What was the configuration needed for pyls
?
@mikew The relevant pyls
settings part of the LSP config is:
"pyls": {
"plugins": {
"pycodestyle": {
"enabled": false
}
}
}
You'll have to figure out how to get your LSP client to pass on the settings, but that should be all you need to disable pycodestyle
linting within pyls
.
The reasoning is that there are lots of tools for python linting, and to avoid keeping up with all of them, we would just integrate with the core set of tools that actually do the lifting. These being pycodestyle, pydocstyle, pyflakes, pylint etc.
I want to point out that in the common case, you're going to want to configure your language server to match exactly what lint settings you are enforcing in, e.g., CI. Not supporting, e.g., flake8 behavior exactly, means the user has to do a bunch of work manually enabling the constituent bits to replicate the lint setting locally.
@gatesn We can start supporting flake8 by introducing a new plugin under plugins/flake8_lint.py
which implements the hook for the linting logic using flake8, we may also update the config/flake8_conf.py
to support more flake8 options if any.
To load the plugin on startup we need to list it under setup.py
, this should get the plugin working. We should then make sure that the user can enable/disable it which I think is already implemented.
It seems that flake8 is not enabled by default in pyls. I am currently using vim-lsp with pyls, the following config works for me:
if executable('pyls')
" pip install python-language-server
au User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']},
\ 'allowlist': ['python'],
\ 'workspace_config': {
\ 'pyls':
\ {'configurationSources': ['flake8'],
\ 'plugins': {'flake8': {'enabled': v:true},
\ 'pyflakes': {'enabled': v:false},
\ 'pycodestyle': {'enabled': v:false},
\ }
\ }
\ }})
endif
The the flake8 config is put in ~/.config/flake8
. Now I am very happy it works. A little issue is that the error code is not shown in the message. But it should be easy to fix.
I'm using neovim/nvim-lspconfig Similar to @ckm2k1 I needed to add a settings key to get flake8 to work, however, still no luck with mypy
require("lspconfig").pyls.setup(
{
enable = true,
settings = {
pyls = {
configurationSources = {"flake8"},
plugins = {
pycodestyle = {enabled = false},
flake8 = {enabled = true},
pyls_mypy = {
enabled = true,
live_mode = false
},
jedi_completion = {fuzzy = true}
}
}
},
on_attach = custom_attach
}
)
Don't know why but pyls
ignores E226 (maybe something else) with this config:
lspconfig.pyls.setup {
cmd = {"pyls"},
filetypes = {"python"},
settings = {
pyls = {
configurationSources = {"flake8"},
plugins = {
jedi_completion = {enabled = true},
jedi_hover = {enabled = true},
jedi_references = {enabled = true},
jedi_signature_help = {enabled = true},
jedi_symbols = {enabled = true, all_scopes = true},
pycodestyle = {enabled = false},
flake8 = {enabled = true},
yapf = {enabled = false},
pylint = {enabled = false},
pydocstyle = {enabled = false},
mccabe = {enabled = false},
preload = {enabled = false},
rope_completion = {enabled = false}
}
}
},
on_attach = on_attach
}
I don't have ~/.config/flake8
at all.
However if I put ignore directive:
lspconfig.pyls.setup {
cmd = {"pyls"},
filetypes = {"python"},
settings = {
pyls = {
configurationSources = {"flake8"},
plugins = {
jedi_completion = {enabled = true},
jedi_hover = {enabled = true},
jedi_references = {enabled = true},
jedi_signature_help = {enabled = true},
jedi_symbols = {enabled = true, all_scopes = true},
pycodestyle = {enabled = false},
flake8 = {
enabled = true,
ignore = {"E402"},
["max-line-length"] = 160
},
yapf = {enabled = false},
pylint = {enabled = false},
pydocstyle = {enabled = false},
mccabe = {enabled = false},
preload = {enabled = false},
rope_completion = {enabled = false}
}
}
},
on_attach = on_attach
}
it starts to respect everything inside it (E402 is not shown, E226 is shown).
But it completely ignores max-line-length
.
What could be the reason for such strange behavior?
I observe the same behaviour: I would like to set the max-line-length
setting but it gets ignored...
I found the answer
If the ignore option is not in the configuration and not in the arguments, only the error codes E123/E133, E226 and E241/E242 are ignored (see the warning and error codes).
https://flake8.pycqa.org/en/2.5.5/config.html#default
@GaetanLepage maxLineLength
did the trick.
Here is my full config for NVIM built-in LSP
lspconfig.pyls.setup {
cmd = {"pyls"},
filetypes = {"python"},
settings = {
pyls = {
configurationSources = {"flake8"},
plugins = {
jedi_completion = {enabled = true},
jedi_hover = {enabled = true},
jedi_references = {enabled = true},
jedi_signature_help = {enabled = true},
jedi_symbols = {enabled = true, all_scopes = true},
pycodestyle = {enabled = false},
flake8 = {
enabled = true,
ignore = {},
maxLineLength = 160
},
mypy = {enabled = false},
isort = {enabled = false},
yapf = {enabled = false},
pylint = {enabled = false},
pydocstyle = {enabled = false},
mccabe = {enabled = false},
preload = {enabled = false},
rope_completion = {enabled = false}
}
}
},
on_attach = on_attach
}