Description
It seems like the way the plugin is written it uses the document.path in the flake8 argument to check for errors:
python-language-server/pyls/plugins/flake8_lint.py
Lines 42 to 45 in f6df42c
Where pycodestyle would actually use the document.lines instead:
python-language-server/pyls/plugins/pycodestyle_lint.py
Lines 33 to 35 in f6df42c
This seems wrong as the flake8 check would ignore the update to the current buffer and always check what is written to disk. From the editor, you basically see all the signs/error lines to be incorrect.
For example, I'm using vim and use vim-lsp-settings, I have a configuration like:
let g:lsp_settings['pyls'] = {
\ 'workspace_config': {'pyls': {'plugins': {
\ 'flake8': {'enabled': v:true,},
\ 'pycodestyle': {'enabled': v:false,},
\ 'pyflakes': {'enabled': v:false},
\ 'mccabe': {'enabled': v:false},
\ }}}
\ }
Say if you have a test.py file with this:
print(y)
Save the file and edit again, you'd see the line is flagged as error.
However, if you insert the line above it and add another print:
print(x)
print(y)
The result is that the error would still only appear on line 1 and NOT both lines since flake8 is run on the file saved on disk. It does not pipe the buffer to it instead.
Flake8 can read from stdin so it should be possible to pipe the lines to the checker. For instance:
cat test.py | flake8 -