Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't override "g d" from godef-jump #435

Open
Lawqup opened this issue Apr 3, 2024 · 2 comments
Open

Can't override "g d" from godef-jump #435

Lawqup opened this issue Apr 3, 2024 · 2 comments

Comments

@Lawqup
Copy link

Lawqup commented Apr 3, 2024

I'm not sure if this is a go mode issue, an evil issue, or some issue with how C-c C-j is being translated to evil-mode keybindings, but I'm unable to rebind "g d" to evil-goto-definition or lsp-find-definition.

I've tried local-set-key, bind-key, making my own minor mode and trying to override "g d".

I have godef installed (apparently the latest version), but for some reason I can't get it to work for anything, e.g.:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104feb5e4]

goroutine 172 [running]:
go/types.(*Checker).handleBailout(0x1400060c400, 0x140002b9c38)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:367 +0x9c
...

This is on OSX but I get the same thing on Arch.

So, I either need to fix godef or rebind "g d" to use the lsp find definition.

I should note, I can bind evil-goto-definition to other stuff like "g D", but this isn't ideal since all other languages use g d to jump to definition.

@Lawqup
Copy link
Author

Lawqup commented Apr 4, 2024

I've found a workaround: override godef-jump in the go mode hook. I.e., in the hook, redefine godef-jump:

(defun godef-jump ()
    (interactive)
    (lsp-find-definition))

@jjuliano
Copy link

jjuliano commented Jun 3, 2024

You can also use go install github.com/jjuliano/godef@latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants