3

I have code something like this:

#[derive(Debug)]
struct Rectangle {
    width: u32,
    height: u32,
}

... and I'm want to dive into source of Debug.

In IntelliJ IDEA I'm put cursor on Debug and pressing cmd + b navigates me to Rust sources.

In VSCode I'm trying to get behavior like in IDEA:

  • put cursor on the same place (middle of on Debug word)
  • open right-click menu
  • press Go to definition (F12) or Go to Implementations(cmd + F12)

And VSCode shows me message No definition found for 'Debug'.

Is there a way to set up navigation by sources in VSCode like in IDEA?

I use this Rust extension in VSCode.

vaan
  • 350
  • 1
  • 8
  • 21
  • 1
    _"but nothing happens"_ Do you mean that the operations appear when right-clicking and they do nothing? Or that they do not appear at all? Have you searched and installed the necessary extensions? Which ones? – E_net4 Oct 20 '21 at 14:17
  • Added info to the question, thanks! – vaan Oct 20 '21 at 14:44

1 Answers1

3

You can do it with the rust-analizer extension, ctrl + click on Debug and it should work. If you are using the Rust extension I advice you against it as it was abandoned.

  • 2
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 20 '21 at 14:32
  • You have to disable and reenable rust-analyzer when you want it to work. – Philip Rego Mar 25 '22 at 02:47