Stream: t-compiler/rust-analyzer

Topic: Emacs jump to defintion on external crates

Kaviraj Kanagaraj (he) (F2'19) (May 21 2020 at 16:33, on Zulip):

Anyone facing issue of not able to jump to definition for external crates "sometimes?"

Sometimes meaning

  1. Working case - You have some crate on cargo.toml (say serde) and you open that project in emacs (rust-analyzer via lsp hook). Now I can jump to definition of serde via M-.
  2. Not working case - you add new crate via "cargo add <xyz>" now use it in your project that is already open. Now I cannot use go-to defintion. But if I do lsp-workspace-restart, I can go to definition of newly added crate (xyz)

is anyone else facing similar issue? can we make it work without lsp-workspace-restart? NOTE: it works with Go + lsp-mode just fine, without any restart.

To me it looks like need to add some hook on every time you add crate via cargo!

Any help is appreciated! thanks :)

Laurențiu (May 21 2020 at 16:39, on Zulip):

Yes, that's normal :-)

Laurențiu (May 21 2020 at 16:39, on Zulip):

See and the related issues

Laurențiu (May 21 2020 at 16:39, on Zulip):

You need to restart the server after changing the project structure.

Kaviraj Kanagaraj (he) (F2'19) (May 21 2020 at 16:47, on Zulip):

ah. I see. thanks for pointing it out! :+1:

Last update: Jul 28 2021 at 05:00UTC