Python
Onivim supports several features from Microsoft's vscode-python
extension, including:
- Code completion
- Go-to-definition
- Hover
- Signature Help
Setup
NOTE: There is a blocking bug (https://github.com/microsoft/vscode-python/issues/12465) in the latest open-vsx package, so the extension needs to be installed manually.
- Download the extension: https://github.com/microsoft/vscode-python/releases/download/2020.5.86806/ms-python-release.vsix
- Run
oni2 --install-extension /path/to/ms-python-release.vsix
- Activate your virtual environment in your python project
- Open
oni2
from your python project folder
If all goes well - you'll see the current python interpreter in the status bar:
FAQ
I'm not getting completions or diagnostics - what can I try?
- Make sure you start Onivim from the active virtual environment. This will set the path to the python modules for the vscode-python extension.
- If the Python interpreter is not inferred correctly, you can set the
"python.pythonPath": "/path/to/python"
configuration setting manually. - If the modules your project using are in a non-standard location, you can add them via the
"python.autoComplete.extraPaths": ["/path/to/customModule"]
configuration setting.