changes the name of a buffer being linted from /tmp/kak-lint.XXXXXX/buf.$extension to /tmp/kak-lint.XXXXXX/$filename. This allows the linter to compile Java files, which fail to compile if the Class name does not match the File name being linted.

This commit is contained in:
James Thomas 2019-05-23 15:52:57 -04:00
parent 9ffde03ca7
commit 5537645ea5

View File

@ -15,14 +15,11 @@ define-command lint -docstring 'Parse the current buffer with a linter' %{
exit 1 exit 1
fi fi
extension="" filename="${kak_buffile##*/}"
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${extension}" printf '%s\n' "evaluate-commands -no-hooks write -sync $dir/${filename}"
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*
@ -33,7 +30,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${extension}" | sort -t: -k2,2 -n > "$dir"/stderr eval "$kak_opt_lintcmd '$dir'/${filename}" | 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}█