diff options
author | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-11-20 10:11:02 +0100 |
---|---|---|
committer | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-11-20 10:11:02 +0100 |
commit | f156548c16d87a60664002a4c88c534486b84de5 (patch) | |
tree | 053c1a3a78f6644c47bc479c47d20701ff776c81 /ale_linters/python | |
parent | 01b661ea25c1abb4f2e6808661d52c7ebdfac85c (diff) | |
parent | 48fe0dd4f629bb1282277ba8a6757a84c13a4dda (diff) | |
download | ale-f156548c16d87a60664002a4c88c534486b84de5.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ale_linters/python')
-rw-r--r-- | ale_linters/python/jedils.vim | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ale_linters/python/jedils.vim b/ale_linters/python/jedils.vim new file mode 100644 index 00000000..eae5fb07 --- /dev/null +++ b/ale_linters/python/jedils.vim @@ -0,0 +1,34 @@ +" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com> +" Description: https://github.com/pappasam/jedi-language-server + +call ale#Set('python_jedils_executable', 'jedi-language-server') +call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_jedils_auto_pipenv', 0) + +function! ale_linters#python#jedils#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server']) +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' + \ : '' + + return ale#Escape(l:executable) . l:exec_args +endfunction + +call ale#linter#Define('python', { +\ 'name': 'jedils', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#python#jedils#GetExecutable'), +\ 'command': function('ale_linters#python#jedils#GetCommand'), +\ 'project_root': function('ale#python#FindProjectRoot'), +\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\}) |