summaryrefslogtreecommitdiff
path: root/ale_linters
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
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')
-rw-r--r--ale_linters/python/jedils.vim8
-rw-r--r--ale_linters/python/pylsp.vim8
-rw-r--r--ale_linters/python/pyright.vim8
3 files changed, 18 insertions, 6 deletions
diff --git a/ale_linters/python/jedils.vim b/ale_linters/python/jedils.vim
index eae5fb07..d3e15bf2 100644
--- a/ale_linters/python/jedils.vim
+++ b/ale_linters/python/jedils.vim
@@ -16,12 +16,16 @@ endfunction
function! ale_linters#python#jedils#GetCommand(buffer) abort
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer)
-
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run jedi-language-server'
\ : ''
+ 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
+ return l:env_string . ale#Escape(l:executable) . l:exec_args
endfunction
call ale#linter#Define('python', {
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', {
diff --git a/ale_linters/python/pyright.vim b/ale_linters/python/pyright.vim
index f16af84c..ccade0c9 100644
--- a/ale_linters/python/pyright.vim
+++ b/ale_linters/python/pyright.vim
@@ -64,12 +64,16 @@ endfunction
function! ale_linters#python#pyright#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer)
-
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pyright'
\ : ''
+ 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 . ' --stdio'
+ return l:env_string . ale#Escape(l:executable) . l:exec_args . ' --stdio'
endfunction
call ale#linter#Define('python', {