summaryrefslogtreecommitdiff
path: root/ale_linters/python
diff options
context:
space:
mode:
authorDerek P Sifford <dereksifford@gmail.com>2018-07-01 14:59:49 -0400
committerDerek P Sifford <dereksifford@gmail.com>2018-07-01 14:59:49 -0400
commitea6d720fecaf79b508535b9e82ecbb0eda0346b6 (patch)
tree642df81f171d499572cb197d524c66f8b2a9871e /ale_linters/python
parent9d98e6db0c5ebc5e7166f7ad9cffb115e9b9fcc5 (diff)
downloadale-ea6d720fecaf79b508535b9e82ecbb0eda0346b6.zip
add pyre lsp linter to python linters
Diffstat (limited to 'ale_linters/python')
-rw-r--r--ale_linters/python/pyre.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/ale_linters/python/pyre.vim b/ale_linters/python/pyre.vim
new file mode 100644
index 00000000..13f77d68
--- /dev/null
+++ b/ale_linters/python/pyre.vim
@@ -0,0 +1,29 @@
+" Author: dsifford <dereksifford@gmail.com>
+" Description: A performant type-checker supporting LSP for Python 3 created by Facebook
+
+call ale#Set('python_pyre_executable', 'pyre')
+call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0))
+
+function! ale_linters#python#pyre#GetExecutable(buffer) abort
+ return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre'])
+endfunction
+
+function! ale_linters#python#pyre#GetCommand(buffer) abort
+ let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer)
+
+ let l:exec_args = l:executable =~? 'pipenv$'
+ \ ? ' run pyre persistent'
+ \ : ' persistent'
+
+ return ale#Escape(l:executable) . l:exec_args
+endfunction
+
+call ale#linter#Define('python', {
+\ 'name': 'pyre',
+\ 'lsp': 'stdio',
+\ 'executable_callback': 'ale_linters#python#pyre#GetExecutable',
+\ 'command_callback': 'ale_linters#python#pyre#GetCommand',
+\ 'language': 'python',
+\ 'project_root_callback': 'ale#python#FindProjectRoot',
+\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
+\})