summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Henrie <n8henrie@users.noreply.github.com>2021-03-17 16:55:50 -0700
committerGitHub <noreply@github.com>2021-03-18 08:55:50 +0900
commited7f4dee532718bd299c42738a3631824b37b5d0 (patch)
tree64504b895cfb191ea881bb261057b9eac5ba53f7
parentdc40ece3c389804df6d9423e0d52c8da2355ea17 (diff)
downloadale-ed7f4dee532718bd299c42738a3631824b37b5d0.zip
issue 3033 (#3620)
* Add ale_python_pyls_options * Add extra explanatory detail * Fix alignment * Fix test
-rw-r--r--ale_linters/python/pyls.vim3
-rw-r--r--doc/ale-python.txt19
-rw-r--r--test/command_callback/test_pyls_command_callback.vader5
3 files changed, 26 insertions, 1 deletions
diff --git a/ale_linters/python/pyls.vim b/ale_linters/python/pyls.vim
index c7f91430..10304b2c 100644
--- a/ale_linters/python/pyls.vim
+++ b/ale_linters/python/pyls.vim
@@ -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', {})
@@ -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', {
diff --git a/doc/ale-python.txt b/doc/ale-python.txt
index 1f263e84..d38d3055 100644
--- a/doc/ale-python.txt
+++ b/doc/ale-python.txt
@@ -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*
diff --git a/test/command_callback/test_pyls_command_callback.vader b/test/command_callback/test_pyls_command_callback.vader
index aff2fcd7..c03b8aeb 100644
--- a/test/command_callback/test_pyls_command_callback.vader
+++ b/test/command_callback/test_pyls_command_callback.vader
@@ -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')