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 `<path>.go:<line>:<colstart>-<colend>` to `<path>.go <line> <colstart>`. However, if the `<path>` contains a dash character, the `sed` will fail and strip everything after this first dash, removing the line and columns information. Closes #4776
This commit is contained in:
parent
91d45a100a
commit
199b7ea165
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue
Block a user