1

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 eglot and rust-mode.

2

1 Answer 1

0

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 (dash-docs and dash-at-point, consult-dash and counsel-dash).

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.

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.