Open docs and source using lsp-mode in emacs

I have lsp-mode mode working pretty well with rust-analzyer in spacemacs. It does a great job of showing types and errors while moving around the source, but I can't figure out how to do two basic things:

  1. Open to the source code of a function or type from a 3rd party package.
  2. Open the documentation of a function or type from a 3rd party package.
1 Like

Hmm, "go to definition" and hover documentation should work for 3rd party crates just like it does for your own code and the standard library. Does it still not work if you restart rust-analyzer after adding the crate?

(If you're looking for a function that opens the documentation in a separate buffer or the browser though, that doesn't exist.)

1 Like

Thanks! I'm not sure what I was doing wrong before, but jump-to-definition (Spc-m-g-g) is now working great opening all source files.

As for the docs, I do get the hover window. But for longer docs, I'd like to be able to at least scroll the window so I can see everything. I'd also like to be able to follow the links within the docs (doesn't need to be a browser) . Are both of those things not possible?

You can scroll the documentation popup with the mouse, I think, but there doesn't seem to be a function to open it in a proper window. It might be worth checking the emacs-lsp repository for that and maybe asking there.

And links in the documentation aren't handled yet in rust-analyzer, I think, but there's a bug for it.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.