You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 1.8.0 (did not check earlier versions yet) when lines are deleted while flake8 lint is running, and the diagnostic would end out of range of current document, flake8 can error out:
It seems there is a mismatch between the state of the document (reflected in document.lines) and the flake8 output. So when document.lines is accessed in the line you referenced, the actual lines are different.
A possible solution could be to pass document.lines to parse_output, instead of document, so that the latter method is called with the current document state.
Could you try that to see if it fixes the problem? Thanks!
It does. In particular, it seems that accessing document.lines in a loop is a bad idea as it reads can read from disk at each access (if the private _source is None):
In 1.8.0 (did not check earlier versions yet) when lines are deleted while flake8 lint is running, and the diagnostic would end out of range of current document, flake8 can error out:
The relevant line is:
python-lsp-server/pylsp/plugins/flake8_lint.py
Line 215 in 6c168d0
To reproduce create a python file like:
variable
This will generate "F821 undefined name 'variable'". Then proceed to removing the empty lines and observe the error. Note:
The text was updated successfully, but these errors were encountered: