mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
call ale#Set('python_mypy_executable', 'mypy')
|
||||
call ale#Set('python_mypy_ignore_invalid_syntax', 0)
|
||||
call ale#Set('python_mypy_show_notes', 1)
|
||||
call ale#Set('python_mypy_options', '')
|
||||
call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_mypy_auto_pipenv', 0)
|
||||
@ -18,6 +19,15 @@ endfunction
|
||||
|
||||
" The directory to change to before running mypy
|
||||
function! s:GetDir(buffer) abort
|
||||
" If we find a directory with "mypy.ini" in it use that,
|
||||
" else try and find the "python project" root, or failing
|
||||
" that, run from the same folder as the current file
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
if filereadable(l:path . '/mypy.ini')
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
|
||||
return !empty(l:project_root)
|
||||
@ -51,7 +61,16 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
" Lines like these should be ignored below:
|
||||
"
|
||||
" file.py:4: note: (Stub files are from https://github.com/python/typeshed)
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$'
|
||||
|
||||
let l:types = 'error|warning'
|
||||
|
||||
if ale#Var(a:buffer, 'python_mypy_show_notes')
|
||||
let l:types = 'error|warning|note'
|
||||
endif
|
||||
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: ('
|
||||
\ . l:types
|
||||
\ . '): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
@ -65,7 +84,7 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : (l:match[4] is# 'note' ? 'I': 'W'),
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
Reference in New Issue
Block a user