diff --git a/README.md b/README.md index 624b5cd..9c5bc5a 100644 --- a/README.md +++ b/README.md @@ -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 0000000..1b91c2c --- /dev/null +++ b/ale_linters/python/pyls.vim @@ -0,0 +1,21 @@ +" Author: aurieh +" 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 2a15f45..90721ef 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 755094a..e34b548 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 9ca0c72..2ee2c2d 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`