考虑如下结构体:
struct Foo;
我想为它写一些文档,所以我写了:
/// whatever
struct Foo;
但是,当我按回车键时,它创建了一个空行:
/// whatever
struct Foo;
代替继续docstring的新行,在它前面加上///
:
/// whatever
///
struct Foo;
我已经6个月没有接触过电脑或编程了。我记得6个月前我就能做到了。也许是因为我在6个月前有一个扩展(也许,RLS?)调用该行为,而我现在没有它。
我如何在Rust和VSCode的换行符中继续文档字符串?
VSCode and Extensions
- VSCode 1.53.0 Rust Extensions (Pack) 0.0.3
- 锈0.7.8
- Rust Analyzer 0.2.481
其他
- 锈迹和货物1.49.0
- Rust - Analyzer(由Rust Analyzer扩展提供)提交336909b
rust-analyzer中确实存在此功能,但需要显式启用。要启用它,您需要向keybindings.json
添加以下内容:
{
"key": "Enter",
"command": "rust-analyzer.onEnter",
"when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust"
}