rc lint: Create temporary file with the same buffer extension
Fixes #2189
This commit is contained in:
parent
075d1048ab
commit
eee0035a0f
|
@ -15,9 +15,14 @@ define-command lint -docstring 'Parse the current buffer with a linter' %{
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
extension=""
|
||||||
|
if printf %s "${kak_buffile}" | grep -qE '[^/.]\.[[:alnum:]]+$'; then
|
||||||
|
extension=".${kak_buffile##*.}"
|
||||||
|
fi
|
||||||
|
|
||||||
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-lint.XXXXXXXX)
|
dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-lint.XXXXXXXX)
|
||||||
mkfifo "$dir"/fifo
|
mkfifo "$dir"/fifo
|
||||||
printf '%s\n' "evaluate-commands -no-hooks write -sync $dir/buf"
|
printf '%s\n' "evaluate-commands -no-hooks write -sync $dir/buf${extension}"
|
||||||
|
|
||||||
printf '%s\n' "evaluate-commands -draft %{
|
printf '%s\n' "evaluate-commands -draft %{
|
||||||
edit! -fifo $dir/fifo -debug *lint-output*
|
edit! -fifo $dir/fifo -debug *lint-output*
|
||||||
|
@ -31,7 +36,7 @@ define-command lint -docstring 'Parse the current buffer with a linter' %{
|
||||||
|
|
||||||
{ # do the parsing in the background and when ready send to the session
|
{ # do the parsing in the background and when ready send to the session
|
||||||
|
|
||||||
eval "$kak_opt_lintcmd '$dir'/buf" | sort -t: -k2,2 -n > "$dir"/stderr
|
eval "$kak_opt_lintcmd '$dir'/buf${extension}" | sort -t: -k2,2 -n > "$dir"/stderr
|
||||||
|
|
||||||
# Flags for the gutter:
|
# Flags for the gutter:
|
||||||
# stamp l3|{red}█ l11|{yellow}█
|
# stamp l3|{red}█ l11|{yellow}█
|
||||||
|
|
Loading…
Reference in New Issue
Block a user