-
Notifications
You must be signed in to change notification settings - Fork 54
Snakerr Plugin
A vy plugin to find errors in python code using pyflakes.
The snakerr plugin uses pyflakes https://github.com/PyCQA/pyflakes to find errors in python code. You need to install pyflakes first in order to use snakerr.
Install pyflakes with:
pip install pyflakes
Once this package is installed just place the code below in your ~/.vy/vyrc file. You can place it in your extra plugins section:
# Python syntax checker through pyflakes.
import vyapp.plugins import snakerr
# The path to pyflakes executable. You don't need to
# uncomment this line if pyflakes executable is available
# in your environment path.
# snakerr.PythonChecker.PATH = 'pyflakes'
# The code to load the plugin.
autoload(snakerr)
The snakerr plugin implements a keycommand that works in PYTHON mode. The vy editor implements such a mode by default. The keycommand that snakerr implements is used to run pyflakes over the current project code to find errors.
Once you open a python file, in order to check for errors using pyflakes just switch to PYTHON mode with:
<Key-exclam>
Then run snakerr on the current opened file:
<Key-h>
After that you would be able to see a line picker widget where you can browse all found errors. In order to jump to the error line you can just press:
<Return>
The snakerr plugin also implements a command that can be used instead of the keycommand above:
py_errors()
Running the above command would display all errors found in the current opened code.
Note: It is necessary to save the current AreaVi data in order to have snakerr correctly displaying the errors. The plugin reads the content from disk not from the AreaVi.