From 199b7ea1659c27f87a46bc96ce3e9a9366eb4102 Mon Sep 17 00:00:00 2001 From: Loric Brevet Date: Fri, 11 Nov 2022 12:59:34 +0100 Subject: [PATCH 1/2] Adjust regex in gopls-def for when filepath contains a dash When calling `:gopls definition`, the gopls LSP server returns the location of the selected definition. Then, `gopls.kak` tries to parse this output to feed the `:edit` command and open the file in Kakoune. To do this, it uses `sed` to transform `.go::-` to `.go `. However, if the `` contains a dash character, the `sed` will fail and strip everything after this first dash, removing the line and columns information. Closes #4776 --- rc/tools/go/gopls.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/tools/go/gopls.kak b/rc/tools/go/gopls.kak index 1d2e1a30..7f90c9cb 100644 --- a/rc/tools/go/gopls.kak +++ b/rc/tools/go/gopls.kak @@ -69,7 +69,7 @@ define-command -hidden -params 1 gopls-cmd %{ define-command -hidden -params 0 gopls-def %{ evaluate-commands %sh{ jump=$( gopls definition "${kak_buffile}:${kak_cursor_line}:${kak_cursor_column}" 2> /dev/null \ - |sed -e 's/-.*//; s/:/ /g; q' ) + |sed -e 's/-[0-9]\+:.*//; s/:/ /g; q' ) if [ -n "${jump}" ]; then printf %s\\n "evaluate-commands -try-client '${kak_opt_jumpclient}' %{ edit ${jump}