mypy: Pass user options before any others (#3582)
This enables us to use a custom `python` exe as the "mypy" executable and pass `-m mypy` in `mypy_options`
This commit is contained in:
parent
3b184f88d3
commit
8cb9f5ef51
2 changed files with 21 additions and 18 deletions
|
@ -43,12 +43,14 @@ function! ale_linters#python#mypy#GetCommand(buffer) abort
|
||||||
\ ? ' run mypy'
|
\ ? ' run mypy'
|
||||||
\ : ''
|
\ : ''
|
||||||
|
|
||||||
|
let l:options = ale#Var(a:buffer, 'python_mypy_options')
|
||||||
|
|
||||||
" We have to always switch to an explicit directory for a command so
|
" We have to always switch to an explicit directory for a command so
|
||||||
" we can know with certainty the base path for the 'filename' keys below.
|
" we can know with certainty the base path for the 'filename' keys below.
|
||||||
return ale#path#CdString(l:dir)
|
return ale#path#CdString(l:dir)
|
||||||
\ . ale#Escape(l:executable) . l:exec_args
|
\ . ale#Escape(l:executable) . l:exec_args
|
||||||
|
\ . (len(l:options) ? (' ' . l:options) : '')
|
||||||
\ . ' --show-column-numbers'
|
\ . ' --show-column-numbers'
|
||||||
\ . ale#Var(a:buffer, 'python_mypy_options')
|
|
||||||
\ . ' --shadow-file %s %t %s'
|
\ . ' --shadow-file %s %t %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ Execute(The mypy command callback should let you set options):
|
||||||
|
|
||||||
AssertLinter 'mypy',
|
AssertLinter 'mypy',
|
||||||
\ ale#path#CdString(g:dir) . ale#Escape('mypy')
|
\ ale#path#CdString(g:dir) . ale#Escape('mypy')
|
||||||
\ . ' --show-column-numbers --some-option '
|
\ . ' --some-option'
|
||||||
|
\ . ' --show-column-numbers'
|
||||||
\ . ' --shadow-file %s %t %s'
|
\ . ' --shadow-file %s %t %s'
|
||||||
|
|
||||||
Execute(The mypy command should switch directories to the detected project root):
|
Execute(The mypy command should switch directories to the detected project root):
|
||||||
|
|
Reference in a new issue