1

我有这样的代码:

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

...我想深入了解Debug.

在 IntelliJ IDEA 中,我将光标放在上面Debug并按下cmd + b导航到 Rust 源。

在 VSCode 中,我试图获得类似 IDEA 中的行为:

  • 将光标放在同一个地方(Debug单词中间)
  • 打开右键菜单
  • Go to definition (F12)Go to Implementations(cmd + F12)

VSCode 向我显示 message No definition found for 'Debug'

有没有办法像在 IDEA 中一样在 VSCode 中设置源导航?

我在 VSCode 中使用了这个 Rust 扩展。

4

1 回答 1

1

您可以使用rust-analizer扩展,按 ctrl + 单击 Debug,它应该可以工作。如果您正在使用 Rust 扩展,我建议您不要使用它,因为它已被放弃。

于 2021-10-20T14:26:31.993 回答