mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-06 09:57:47 +08:00
#283 Fix linting buffers with no filename, by creating a filename with a guess for the file extension
This commit is contained in:
@@ -286,11 +286,17 @@ function! ale#engine#EscapeCommandPart(command_part) abort
|
||||
endfunction
|
||||
|
||||
function! s:TemporaryFilename(buffer) abort
|
||||
let l:filename = fnamemodify(bufname(a:buffer), ':t')
|
||||
|
||||
if empty(l:filename)
|
||||
" If the buffer's filename is empty, create a dummy filename.
|
||||
let l:ft = getbufvar(a:buffer, '&filetype')
|
||||
let l:filename = 'file' . ale#filetypes#GuessExtension(l:ft)
|
||||
endif
|
||||
|
||||
" Create a temporary filename, <temp_dir>/<original_basename>
|
||||
" The file itself will not be created by this function.
|
||||
return tempname()
|
||||
\ . (has('win32') ? '\' : '/')
|
||||
\ . fnamemodify(bufname(a:buffer), ':t')
|
||||
return tempname() . (has('win32') ? '\' : '/') . l:filename
|
||||
endfunction
|
||||
|
||||
" Given a command string, replace every...
|
||||
|
||||
Reference in New Issue
Block a user