mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -74,23 +74,18 @@ let s:end_col_pattern_map = {
|
||||
\}
|
||||
|
||||
function! ale_linters#python#flake8#Handle(buffer, lines) abort
|
||||
for l:line in a:lines[:10]
|
||||
if match(l:line, '^Traceback') >= 0
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': 'An exception was thrown. See :ALEDetail',
|
||||
\ 'detail': join(a:lines, "\n"),
|
||||
\}]
|
||||
endif
|
||||
endfor
|
||||
let l:output = ale#python#HandleTraceback(a:lines, 10)
|
||||
|
||||
if !empty(l:output)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" stdin:6:6: E111 indentation is not a multiple of four
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+) (.*)$'
|
||||
let l:output = []
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[3]
|
||||
@ -148,7 +143,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'flake8',
|
||||
\ 'executable_callback': 'ale_linters#python#flake8#GetExecutable',
|
||||
\ 'executable': function('ale_linters#python#flake8#GetExecutable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#python#flake8#VersionCheck'},
|
||||
\ {'callback': 'ale_linters#python#flake8#GetCommand', 'output_stream': 'both'},
|
||||
|
@ -75,7 +75,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'mypy',
|
||||
\ 'executable_callback': 'ale_linters#python#mypy#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#mypy#GetCommand',
|
||||
\ 'executable': function('ale_linters#python#mypy#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#mypy#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#mypy#Handle',
|
||||
\})
|
||||
|
@ -93,8 +93,8 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'prospector',
|
||||
\ 'executable_callback': 'ale_linters#python#prospector#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#prospector#GetCommand',
|
||||
\ 'executable': function('ale_linters#python#prospector#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#prospector#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#prospector#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
@ -69,7 +69,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pycodestyle',
|
||||
\ 'executable_callback': 'ale_linters#python#pycodestyle#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pycodestyle#GetCommand',
|
||||
\ 'executable': function('ale_linters#python#pycodestyle#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#pycodestyle#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#pycodestyle#Handle',
|
||||
\})
|
||||
|
@ -33,8 +33,7 @@ function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" mydir/myfile.py:33 in public function `myfunction`:
|
||||
" DXXX: Error description
|
||||
let l:fname = ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
|
||||
let l:line1_pattern = '\v^' . l:fname . ':\s*(\d+)\s+.*$'
|
||||
let l:line1_pattern = '\v^.*:\s*(\d+)\s+.*$'
|
||||
let l:line2_pattern = '\v^.*([a-zA-Z]\d+):\s*(.*)$'
|
||||
let l:output = []
|
||||
|
||||
@ -68,7 +67,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pydocstyle',
|
||||
\ 'executable_callback': 'ale_linters#python#pydocstyle#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pydocstyle#GetCommand',
|
||||
\ 'executable': function('ale_linters#python#pydocstyle#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#pydocstyle#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#pydocstyle#Handle',
|
||||
\})
|
||||
|
@ -43,8 +43,8 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pyflakes',
|
||||
\ 'executable_callback': 'ale_linters#python#pyflakes#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pyflakes#GetCommand',
|
||||
\ 'executable': function('ale_linters#python#pyflakes#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#pyflakes#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#pyflakes#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\})
|
||||
|
@ -17,9 +17,17 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylint#GetCommand(buffer) abort
|
||||
let l:cd_string = ale#Var(a:buffer, 'python_pylint_change_directory')
|
||||
\ ? ale#path#BufferCdString(a:buffer)
|
||||
\ : ''
|
||||
let l:cd_string = ''
|
||||
|
||||
if ale#Var(a:buffer, 'python_pylint_change_directory')
|
||||
" pylint only checks for pylintrc in the packages above its current
|
||||
" directory before falling back to user and global pylintrc.
|
||||
" Run from project root, if found, otherwise buffer dir.
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
let l:cd_string = l:project_root isnot# ''
|
||||
\ ? ale#path#CdString(l:project_root)
|
||||
\ : ale#path#BufferCdString(a:buffer)
|
||||
endif
|
||||
|
||||
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer)
|
||||
|
||||
@ -53,7 +61,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
||||
|
||||
if l:code is# 'I0011'
|
||||
" Skip 'Locally disabling' message
|
||||
continue
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
@ -70,8 +78,8 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pylint',
|
||||
\ 'executable_callback': 'ale_linters#python#pylint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pylint#GetCommand',
|
||||
\ 'executable': function('ale_linters#python#pylint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#pylint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#pylint#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
@ -4,6 +4,7 @@
|
||||
call ale#Set('python_pyls_executable', 'pyls')
|
||||
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', {})
|
||||
|
||||
function! ale_linters#python#pyls#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyls_auto_pipenv'))
|
||||
@ -27,8 +28,9 @@ endfunction
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pyls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pyls#GetCommand',
|
||||
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
||||
\ 'executable': function('ale_linters#python#pyls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#pyls#GetCommand'),
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'python_pyls_config')},
|
||||
\})
|
||||
|
@ -27,8 +27,8 @@ endfunction
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pyre',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#python#pyre#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pyre#GetCommand',
|
||||
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
||||
\ 'executable': function('ale_linters#python#pyre#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#pyre#GetCommand'),
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
\})
|
||||
|
@ -46,19 +46,14 @@ endfunction
|
||||
|
||||
|
||||
function! ale_linters#python#vulture#Handle(buffer, lines) abort
|
||||
for l:line in a:lines[:10]
|
||||
if match(l:line, '^Traceback') >= 0
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': 'An exception was thrown. See :ALEDetail',
|
||||
\ 'detail': join(a:lines, "\n"),
|
||||
\}]
|
||||
endif
|
||||
endfor
|
||||
let l:output = ale#python#HandleTraceback(a:lines, 10)
|
||||
|
||||
if !empty(l:output)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
" Matches patterns line the following:
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (.*)$'
|
||||
let l:output = []
|
||||
let l:dir = s:GetDir(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
@ -78,8 +73,8 @@ endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'vulture',
|
||||
\ 'executable_callback': 'ale_linters#python#vulture#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#vulture#GetCommand',
|
||||
\ 'executable': function('ale_linters#python#vulture#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#vulture#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#vulture#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
Reference in New Issue
Block a user