fix: linter discards unsaved changes
The content of the current buffer is written to the tempfile instead of copying the file. So unsaved changes will no longer be discarded silently.
This commit is contained in:
parent
db4a01e197
commit
6d2acb7635
@ -186,8 +186,9 @@ if !exists('g:formatdef_eslint_local')
|
|||||||
" This formatter uses a temporary file as ESLint has not option to print
|
" This formatter uses a temporary file as ESLint has not option to print
|
||||||
" the formatted source to stdout without modifieing the file.
|
" the formatted source to stdout without modifieing the file.
|
||||||
let l:eslint_js_tmp_file = fnameescape(tempname().".js")
|
let l:eslint_js_tmp_file = fnameescape(tempname().".js")
|
||||||
return "rm -f ".l:eslint_js_tmp_file."; cat ".l:path." > ".l:eslint_js_tmp_file.";"
|
let content = getline('1', '$')
|
||||||
\ .l:prog." -c ".l:cfg." --fix ".l:eslint_js_tmp_file." 1> /dev/null; exit_code=$?
|
call writefile(content, l:eslint_js_tmp_file)
|
||||||
|
return l:prog." -c ".l:cfg." --fix ".l:eslint_js_tmp_file." 1> /dev/null; exit_code=$?
|
||||||
\ cat ".l:eslint_js_tmp_file."; rm -f ".l:eslint_js_tmp_file."; exit $exit_code"
|
\ cat ".l:eslint_js_tmp_file."; rm -f ".l:eslint_js_tmp_file."; exit $exit_code"
|
||||||
endfunction
|
endfunction
|
||||||
let g:formatdef_eslint_local = "g:BuildESLintLocalCmd()"
|
let g:formatdef_eslint_local = "g:BuildESLintLocalCmd()"
|
||||||
|
Loading…
Reference in New Issue
Block a user