Further fixes in go-tools.kak to improve its robustness
This commit is contained in:
parent
73b6f0994f
commit
d65c99a448
|
@ -30,10 +30,14 @@ define-command go-complete -docstring "Complete the current selection with gocod
|
||||||
(
|
(
|
||||||
gocode_data=$(gocode -f=godit --in=${dir}/buf autocomplete ${kak_cursor_byte_offset})
|
gocode_data=$(gocode -f=godit --in=${dir}/buf autocomplete ${kak_cursor_byte_offset})
|
||||||
rm -r ${dir}
|
rm -r ${dir}
|
||||||
column_offset=$(echo "${gocode_data}" | head -n1 | cut -d, -f1)
|
column_offset=$(printf %s "${gocode_data}" | head -n1 | cut -d, -f1)
|
||||||
|
|
||||||
header="${kak_cursor_line}.$((${kak_cursor_column} - $column_offset))@${kak_timestamp}"
|
header="${kak_cursor_line}.$((${kak_cursor_column} - $column_offset))@${kak_timestamp}"
|
||||||
compl=$(echo "${gocode_data}" | sed 1d | awk -F ",," '{print "%~" $2 "||" $1 "~"}' | paste -s -)
|
compl=$(echo "${gocode_data}" | sed 1d | awk -F ",," '{
|
||||||
|
gsub(/~/, "~~", $1)
|
||||||
|
gsub(/~/, "~~", $2)
|
||||||
|
print "%~" $2 "||" $1 "~"
|
||||||
|
}' | paste -s -)
|
||||||
printf %s\\n "evaluate-commands -client '${kak_client}' %{
|
printf %s\\n "evaluate-commands -client '${kak_client}' %{
|
||||||
set-option 'buffer=${kak_bufname}' gocode_completions ${header} ${compl}
|
set-option 'buffer=${kak_bufname}' gocode_completions ${header} ${compl}
|
||||||
}" | kak -p ${kak_session}
|
}" | kak -p ${kak_session}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user