mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 04:34:25 +08:00
Correctly identify tempfiles once symlinks are resolved (#3726)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some linters will expand the paths of symlinked tempfiles when reporting them back to ALE. This ensures that if they do, the filename is still flagged appropriately as being temporary.
This commit is contained in:
@@ -124,11 +124,16 @@ function! ale#path#IsAbsolute(filename) abort
|
||||
endfunction
|
||||
|
||||
let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h'))
|
||||
let s:resolved_temp_dir = resolve(s:temp_dir)
|
||||
|
||||
" Given a filename, return 1 if the file represents some temporary file
|
||||
" created by Vim.
|
||||
" created by Vim. If the temporary location is symlinked (e.g. macOS), some
|
||||
" linters may report the resolved version of the path, so both are checked.
|
||||
function! ale#path#IsTempName(filename) abort
|
||||
return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir
|
||||
let l:filename = ale#path#Simplify(a:filename)
|
||||
|
||||
return l:filename[:len(s:temp_dir) - 1] is# s:temp_dir
|
||||
\|| l:filename[:len(s:resolved_temp_dir) - 1] is# s:resolved_temp_dir
|
||||
endfunction
|
||||
|
||||
" Given a base directory, which must not have a trailing slash, and a
|
||||
|
||||
Reference in New Issue
Block a user