mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-29 22:32:17 +08:00
#2132 Unify temporary file management in command.vim
This commit is contained in:
@@ -12,7 +12,7 @@ function! ale_linters#ada#gcc#GetCommand(buffer) abort
|
||||
" the .ali file may be created even if no code generation is attempted.
|
||||
" The output file name must match the source file name (except for the
|
||||
" extension), so here we cannot use the null file as output.
|
||||
let l:tmp_dir = fnamemodify(ale#engine#CreateDirectory(a:buffer), ':p')
|
||||
let l:tmp_dir = fnamemodify(ale#command#CreateDirectory(a:buffer), ':p')
|
||||
let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o'
|
||||
|
||||
" -gnatc: Check syntax and semantics only (no code generation attempted)
|
||||
|
||||
@@ -30,7 +30,7 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
|
||||
" register temporary module target file with ale
|
||||
" register temporary module target file with ALE.
|
||||
let l:out = ale#engine#CreateFile(a:buffer)
|
||||
let l:out = ale#command#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
|
||||
@@ -7,7 +7,7 @@ call ale#Set('cuda_nvcc_options', '-std=c++11')
|
||||
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||
" Unused: use ale#util#nul_file
|
||||
" let l:output_file = ale#util#Tempname() . '.ii'
|
||||
" call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
" call ale#command#ManageFile(a:buffer, l:output_file)
|
||||
return '%e -cuda'
|
||||
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
|
||||
|
||||
@@ -32,7 +32,7 @@ endfunction
|
||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
|
||||
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
|
||||
|
||||
let l:mix_build_path = has('win32')
|
||||
\ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&'
|
||||
|
||||
@@ -4,7 +4,7 @@ let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||
|
||||
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||
let l:output_file = ale#util#Tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
call ale#command#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return 'erlc -o ' . ale#Escape(l:output_file)
|
||||
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
|
||||
|
||||
@@ -73,7 +73,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
||||
endif
|
||||
|
||||
" Create .class files in a temporary directory, which we will delete later.
|
||||
let l:class_file_directory = ale#engine#CreateDirectory(a:buffer)
|
||||
let l:class_file_directory = ale#command#CreateDirectory(a:buffer)
|
||||
|
||||
" Always run javac from the directory the file is in, so we can resolve
|
||||
" relative paths correctly.
|
||||
|
||||
@@ -16,7 +16,7 @@ function! ale_linters#thrift#thrift#GetCommand(buffer) abort
|
||||
let l:generators = ['cpp']
|
||||
endif
|
||||
|
||||
let l:output_dir = ale#engine#CreateDirectory(a:buffer)
|
||||
let l:output_dir = ale#command#CreateDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(join(map(copy(l:generators), "'--gen ' . v:val")))
|
||||
|
||||
@@ -10,7 +10,7 @@ function! ale_linters#verilog#verilator#GetCommand(buffer) abort
|
||||
let l:filename = ale#util#Tempname() . '_verilator_linted.v'
|
||||
|
||||
" Create a special filename, so we can detect it in the handler.
|
||||
call ale#engine#ManageFile(a:buffer, l:filename)
|
||||
call ale#command#ManageFile(a:buffer, l:filename)
|
||||
let l:lines = getbufline(a:buffer, 1, '$')
|
||||
call ale#util#Writefile(a:buffer, l:lines, l:filename)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ endfunction
|
||||
function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort
|
||||
let l:dir = s:GetALEProjectDir(a:buffer)
|
||||
|
||||
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
|
||||
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
|
||||
let l:temp_file = l:temp_dir . '/example.vim'
|
||||
|
||||
let l:lines = getbufline(a:buffer, 1, '$')
|
||||
|
||||
Reference in New Issue
Block a user