From cbbab07aabacd07ac40045f9d881ba1241f42758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=96R=C3=96SK=C5=90I=20Andr=C3=A1s?= Date: Fri, 16 Oct 2020 22:40:58 +0200 Subject: [PATCH] gopls: Fix format/imports error reporting Remove unnecessary single quotes and whitespaces in %file{} Do not delete error file before sending to debug buffer Fix gopls definition error handling and empty sting check Silence shellcheck warnings --- rc/tools/go/gopls.kak | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rc/tools/go/gopls.kak b/rc/tools/go/gopls.kak index 6ae19e12..c4781a04 100644 --- a/rc/tools/go/gopls.kak +++ b/rc/tools/go/gopls.kak @@ -55,22 +55,22 @@ define-command -hidden -params 1 gopls-cmd %{ gopls-prepare evaluate-commands %sh{ dir=${kak_opt_gopls_tmp_dir} - gopls $1 -w ${kak_buffile} 2> "${dir}/stderr" + gopls "$1" -w "${kak_buffile}" 2> "${dir}/stderr" if [ $? -ne 0 ]; then # show error messages in *debug* buffer - printf %s\\n "echo -debug %file{ '${dir}/stderr' }" + printf %s\\n "echo -debug %file{${dir}/stderr}" fi - rm -r "${dir}" } edit! + evaluate-commands %sh{ rm -r "${kak_opt_gopls_tmp_dir}" } } # gopls definition define-command -hidden -params 0 gopls-def %{ evaluate-commands %sh{ - jump=$( gopls definition ${kak_buffile}:${kak_cursor_line}:${kak_cursor_column} \ - |sed -e 's/-.*//; s/:/ /g; q' 2> /dev/null ) - if [ "cat ${jump}" != "" ]; then + jump=$( gopls definition "${kak_buffile}:${kak_cursor_line}:${kak_cursor_column}" 2> /dev/null \ + |sed -e 's/-.*//; s/:/ /g; q' ) + if [ -n "${jump}" ]; then printf %s\\n "evaluate-commands -try-client '${kak_opt_jumpclient}' %{ edit ${jump} }" @@ -84,7 +84,7 @@ define-command -hidden -params 0 gopls-ref %{ evaluate-commands %sh{ dir=${kak_opt_gopls_tmp_dir} mkfifo "${dir}/fifo" - ( gopls references ${kak_buffile}:${kak_cursor_line}:${kak_cursor_column} \ + ( gopls references "${kak_buffile}:${kak_cursor_line}:${kak_cursor_column}" \ > "${dir}/fifo" 2> /dev/null & ) > /dev/null 2>&1 < /dev/null # using filetype=grep for nice hilight and mapping printf %s\\n "evaluate-commands -try-client '${kak_opt_toolsclient}' %{