andviro / flake8-vim

Pyflakes, Pep8 and mccabe code complexity checker for Vim, bundled with latest libraries for easy installation
63 stars 18 forks source link

Gutter markings incorrect after deleting lines #22

Closed wolph closed 8 years ago

wolph commented 8 years ago

As you can see, after deleting the two lines that are marked as errors, the import os line is now marked as an error which is incorrect. Only after saving the file again it is marked as correct again. But in some cases that doesn't happen either.

Any idea what could be wrong with my config? Or is it a bug?

incorrect_lines

andviro commented 8 years ago

Hi there. It's a particular way the signs are handled in Vim. When you delete lines, signs are not updated until you save the buffer, effectively running :PyFlake command. As for the cases when signs are not updated even after saving, please try to reproduce one and post it here.

wolph commented 8 years ago

Ah, that's too bad. Would you happen to know if there's any autocmd to bind to or would I have to remap dd to make it work? There should be some way to make it a bit smarter, especially with unused imports it's pretty much unusable at the moment. After you delete a line the next error is on the wrong line.

As for the signs not being updated after saving, I've had it a few times but it's not consistently repeatable so it might be related to one of my other bundles.

andviro commented 8 years ago

Oh, I just hit :w now and then. Another way would be to run checks on idle or on some kind of periodic timer, but it will make the whole affair sluggish.

wolph commented 8 years ago

Hitting :w is what I do now but it's just a tad annoying... I'm going to keep on looking for a better solution. Thanks for the quick response though, greatly appreciated :)

wolph commented 8 years ago

Well, I found a solution:

autocmd TextChanged *.py silent PyFlake
andviro commented 8 years ago

Good, but not very usable in general, because it will be called very often and on big files may slow down editing.