Close #2472 - Add support for pyright

This commit is contained in:
w0rp
2020-08-07 12:16:13 +01:00
parent 9bdabce8df
commit 19229e8e27
8 changed files with 225 additions and 3 deletions

View File

@@ -598,6 +598,7 @@ g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id*
Use message for output (e.g. I0011) instead of symbolic name of the message
(e.g. locally-disabled).
===============================================================================
pyls *ale-python-pyls*
@@ -682,6 +683,65 @@ g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv*
if true. This is overridden by a manually-set executable.
===============================================================================
pyright *ale-python-pyright*
The `pyrlight` linter requires a recent version of `pyright` which includes
the `pyright-langserver` executable. You can install `pyright` on your system
through `npm` with `sudo npm install -g pyright` or similar.
Refer to their README for installation instructions:
https://github.com/Microsoft/pyright
`pyright` needs to know the path to your Python executable and probably a
virtualenv to run. ALE will try to detect these automatically.
See |g:ale_python_pyright_config|.
g:ale_python_pyright_executable *g:ale_python_pyright_executable*
*b:ale_python_pyright_executable*
Type: |String|
Default: `'pyright-langserver'`
The executable for running `pyright`, which is typically installed globally.
g:ale_python_pyright_config *g:ale_python_pyright_config*
*b:ale_python_pyright_config*
Type: |Dictionary|
Default: `{}`
Settings for configuring the `pyright` language server.
See pyright's documentation for a full list of options:
https://github.com/microsoft/pyright/blob/master/docs/settings.md
ALE will automatically try to set defaults for `venvPath` and `pythonPath`
so your project can automatically be checked with the right libraries.
You can override these settings with whatever you want in your ftplugin
file like so: >
let b:ale_python_pyright_config = {
\ 'python': {
\ 'pythonPath': '/bin/python',
\ 'venvPath': '/other/dir',
\ },
\}
<
If `venvPath` is set, but `pythonPath` is not,
ALE will use `venvPath . '/bin/python'` or similar as `pythonPath`.
A commonly used setting for `pyright` is disabling language services
apart from type checking and "hover" (|ale-hover|), you can set this
setting like so, or use whatever other settings you want: >
let b:ale_python_pyright_config = {
\ 'pyright': {
\ 'disableLanguageServices': v:true,
\ },
\}
<
===============================================================================
reorder-python-imports *ale-python-reorder_python_imports*