Skip to content

issue 3033 #3620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ale_linters/python/pyls.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
" Description: A language server for Python

call ale#Set('python_pyls_executable', 'pyls')
call ale#Set('python_pyls_options', '')
call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyls_auto_pipenv', 0)
call ale#Set('python_pyls_config', {})
Expand All @@ -22,7 +23,7 @@ function! ale_linters#python#pyls#GetCommand(buffer) abort
\ ? ' run pyls'
\ : ''

return ale#Escape(l:executable) . l:exec_args
return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pyls_options'))
endfunction

call ale#linter#Define('python', {
Expand Down
19 changes: 19 additions & 0 deletions doc/ale-python.txt
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,25 @@ g:ale_python_pyls_config *g:ale_python_pyls_config*
\ }
<

g:ale_python_pyls_options *g:ale_python_pyls_options*
*b:ale_python_pyls_options*
Type: |String|
Default: `''`

This variable can be changed to add command-line arguments to the pyls
invocation. Note that this is not the same thing as ale_python_pyls_config,
which allows configuration of how pyls functions; this is intended to
provide flexibility in how the pyls command is invoked.

For example, if you had installed `pyls` but your `pyls` executable was not
on your `PATH` for some reason, an alternative way to run the pyls server
would be:
let g:ale_python_pyls_executable = 'python3'
let g:ale_python_pyls_options = '-m pyls'

An example stragety for installing `pyls`:
`python3 -m pip install --user pyls`

===============================================================================
pyre *ale-python-pyre*

Expand Down
5 changes: 5 additions & 0 deletions test/command_callback/test_pyls_command_callback.vader
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Execute(The pyls executable should be configurable):

AssertLinter '~/.local/bin/pyls' , ale#Escape('~/.local/bin/pyls')

Execute(The pyls command callback should let you set options):
let g:ale_python_pyls_options = '--some-option'

AssertLinter 'pyls', ale#Escape('pyls') . ' --some-option'

Execute(The pyls executable should be run from the virtualenv path):
call ale#test#SetFilename('python_paths/with_virtualenv/subdir/foo/bar.py')

Expand Down