While running gopls and lsp-mode on a Golang project, is there a way to list all implementations of an interface's function?

When invoked on a function name, xref-find-definition jumps inside the interface definition. For example, M-. on function area in this example will jump to the area() line in:

type geometry interface {
    area() float64
    perim() float64

..and not to its implementation. This is expected behavior since only at runtime could the actual function that gets called be derived.

As for xref-find-references, the list does not include the function definitions - just the interface definition and calls to it, which again, makes sense.

However, this is not what one often looks for when they want to jump based on a function call. Is there a way to jump to or list implementations of an interface's function?

1 Answer 1


lsp-find-implementation is the function that does exactly that. The xref interface doesn't include a function for searching for interface implementations, so it's provided by lsp-mode independently of xref.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.