diff options
author | Auri <me@aurieh.me> | 2017-11-08 19:58:56 +0200 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-11-08 17:58:56 +0000 |
commit | 8a4cf923a8a3017fa683bd27d699d9b14720cd66 (patch) | |
tree | 7938bae1f68a36c332d3121ed6a1e58b5f8233c0 | |
parent | 86e807401795e3dcc9cac63dd3deb1323d048f13 (diff) | |
download | ale-8a4cf923a8a3017fa683bd27d699d9b14720cd66.zip |
Add PyLS linter (#1097)
* Support PyLS (python language server)
* Replace pyls#GetProjectRoot and add more config types to ale#python#FindProjectRoot
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | ale_linters/python/pyls.vim | 21 | ||||
-rw-r--r-- | autoload/ale/python.vim | 2 | ||||
-rw-r--r-- | doc/ale-python.txt | 9 | ||||
-rw-r--r-- | doc/ale.txt | 3 |
5 files changed, 35 insertions, 2 deletions
@@ -126,7 +126,7 @@ formatting. | Pod | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) | | Pug | [pug-lint](https://github.com/pugjs/pug-lint) | | Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) | -| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) | +| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) | | R | [lintr](https://github.com/jimhester/lintr) | | ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions, [refmt](https://github.com/reasonml/reason-cli) | | reStructuredText | [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) | diff --git a/ale_linters/python/pyls.vim b/ale_linters/python/pyls.vim new file mode 100644 index 00000000..1b91c2c7 --- /dev/null +++ b/ale_linters/python/pyls.vim @@ -0,0 +1,21 @@ +" Author: aurieh <me@aurieh.me> +" Description: A language server for Python + +call ale#Set('python_pyls_executable', 'pyls') + +function! ale_linters#python#pyls#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'python_pyls_executable') +endfunction + +function! ale_linters#python#pyls#GetLanguage(buffer) abort + return 'python' +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pyls', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable', +\ 'command_callback': 'ale_linters#python#pyls#GetExecutable', +\ 'language_callback': 'ale_linters#python#pyls#GetLanguage', +\ 'project_root_callback': 'ale#python#FindProjectRoot', +\}) diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim index 2a15f454..90721ef1 100644 --- a/autoload/ale/python.vim +++ b/autoload/ale/python.vim @@ -18,6 +18,8 @@ function! ale#python#FindProjectRootIni(buffer) abort \|| filereadable(l:path . '/setup.cfg') \|| filereadable(l:path . '/pytest.ini') \|| filereadable(l:path . '/tox.ini') + \|| filereadable(l:path . '/pycodestyle.cfg') + \|| filereadable(l:path . '/flake8.cfg') return l:path endif endfor diff --git a/doc/ale-python.txt b/doc/ale-python.txt index 755094a3..e34b548f 100644 --- a/doc/ale-python.txt +++ b/doc/ale-python.txt @@ -189,6 +189,15 @@ g:ale_python_pylint_use_global *g:ale_python_pylint_use_global* See |ale-integrations-local-executables| +=============================================================================== +pyls *ale-python-pyls* + +g:ale_python_pyls_executable *g:ale_python_pyls_executable* + *b:ale_python_pyls_executable* + Type: |String| + Default: `pyls` + + See |ale-integrations-local-executables| =============================================================================== yapf *ale-python-yapf* diff --git a/doc/ale.txt b/doc/ale.txt index 9ca0c727..2ee2c2d7 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -145,6 +145,7 @@ CONTENTS *ale-contents* mypy................................|ale-python-mypy| pycodestyle.........................|ale-python-pycodestyle| pylint..............................|ale-python-pylint| + pyls................................|ale-python-pyls| yapf................................|ale-python-yapf| r.....................................|ale-r-options| lintr...............................|ale-r-lintr| @@ -309,7 +310,7 @@ Notes: * Pod: `proselint`, `write-good` * Pug: `pug-lint` * Puppet: `puppet`, `puppet-lint` -* Python: `autopep8`, `flake8`, `isort`, `mypy`, `pycodestyle`, `pylint`!!, `yapf` +* Python: `autopep8`, `flake8`, `isort`, `mypy`, `pycodestyle`, `pyls`, `pylint`!!, `yapf` * R: `lintr` * ReasonML: `merlin`, `refmt` * reStructuredText: `proselint`, `write-good` |