考虑如下结构:
struct Foo;
我想为此编写一些文档,所以我这样做:/// whatever
struct Foo;
但是,当我按Enter键时,它将创建一个空行:/// whatever
struct Foo;
而不是用新行继续docstring,而是在其前面添加///
:/// whatever
///
struct Foo;
我六个月都没有接触计算机或编程。我记得我可以在6个月前做到这一点。可能是因为我有一个扩展(也许是RLS吗?)在6个月前调用了该行为,而我现在还没有。如何在Rust和VSCode中的换行符中继续文档字符串?
VSCode和扩展
其他
最佳答案
该功能确实存在于rust-analyzer中,但需要显式启用。要启用它,您需要在keybindings.json
中添加以下内容:
{
"key": "Enter",
"command": "rust-analyzer.onEnter",
"when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust"
}
关于visual-studio-code - 在Rust和VSCode的新行中继续Docstring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66118871/