summaryrefslogtreecommitdiff
path: root/ale_linters/python/pylsp.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2023-02-08 09:11:31 +0000
committerw0rp <devw0rp@gmail.com>2023-02-08 09:11:31 +0000
commit4c162877e2943ac8f6b29bc79ccf313f8eb88ba6 (patch)
tree7f40105c0a914615ae3bd1bdfb607d1409222b9f /ale_linters/python/pylsp.vim
parent6ff1f0b200f9d280b44b9fa59fde232bdb9fe32f (diff)
downloadale-4c162877e2943ac8f6b29bc79ccf313f8eb88ba6.zip
#2172 Auto PATH with ale_python_auto_virtualenv
Automatically set `PATH` for some Python linters that seem to need it when g:ale_python_auto_virtualenv or b:ale_python_auto_virtualenv is `1`.
Diffstat (limited to 'ale_linters/python/pylsp.vim')
-rw-r--r--ale_linters/python/pylsp.vim8
1 files changed, 6 insertions, 2 deletions
diff --git a/ale_linters/python/pylsp.vim b/ale_linters/python/pylsp.vim
index a699e4f6..a1c31018 100644
--- a/ale_linters/python/pylsp.vim
+++ b/ale_linters/python/pylsp.vim
@@ -37,12 +37,16 @@ endfunction
function! ale_linters#python#pylsp#GetCommand(buffer) abort
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
-
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pylsp'
\ : ''
+ let l:env_string = ''
+
+ if ale#Var(a:buffer, 'python_auto_virtualenv')
+ let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
+ endif
- return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options'))
+ return l:env_string . ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options'))
endfunction
call ale#linter#Define('python', {