VSC:如何自动关闭 f 字符串中的大括号

pun*_*her 4 python visual-studio-code

您好,我想问是否可以在 Visual Studio Code 中的 f 字符串中启用自动关闭大括号。在 Python 中,您经常使用 f 字符串,因此需要大括号。

print(f"Hello {name}!")
Run Code Online (Sandbox Code Playgroud)

我已经找到了一些东西,但我不知道该功能是否已经实现,如果没有,我是否可以使用外部插件来实现它?:https://github.com/microsoft/vscode-python/issues/13673

小智 5

使用“始终”自动闭括号设置,但在 settings.json 中将其限制为 Python:

"[python]": {
    "editor.autoClosingBrackets": "always"
}
Run Code Online (Sandbox Code Playgroud)