According to the changelog, Rust-Analyzer has a command
openDocs since 2020. It should open the documentation for the symbol under the cursor.
How could I call this from emacs? I'm using
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
If you can't get this to work with rust-analyzer you can also consider other documentation backend - especially if you simply want to "open the documentation for the symbol under the cursor" which should be fairly consistent no matter what tool you use to retrieve it. For example, great docsets for a large number of programming languages is something that Dash provides. There are Emacs packages for Dash integration (
As for selecting the symbol to look up the documentation for, you can either rely on whatever you already use for extracting the word/symbol at point, or you can customize it to your needs e.g. by using
thing-at-point functions (maybe also
thingatpt+) or you can search the source code for Doom or Spacemacs which provide very convenient wrappers for thing at point and documentation functions which have convenient wrappers for this. Their support for Rust may already satisfy your needs - e.g. Doom has a
+lookup module which does all of that.