如何阻止VS代码强制我使用大括号,否则光标位置变得疯狂(PHP,或全局应用)

Gam*_*Gam 9 visual-studio-code vscode-extensions

VS代码

if (1 == 1)  // When I hit enter here, the cursor moves to the next line at pos (0)
|
else  
    return; // When I hit enter here, cursor moves to next line/ pos 4
    |       // why is the cursor here? why not pos 0? 
Run Code Online (Sandbox Code Playgroud)

Visual Studio(这就是我想要发生的事情)

if (1 == 1)   // When I hit enter here, the cursor moves to the next line at
    |         // pos 1 if I'm working with Tabs or pos 4 for spaces)
Run Code Online (Sandbox Code Playgroud)

如果你使用这样的大括号,这在VS Code中不是问题:

if (1 == 1){
    return;
}
Run Code Online (Sandbox Code Playgroud)

但是,我不喜欢在那些场景中使用大括号,如果我不这样做,VS Code自然会让我最终编写这段代码,这也很糟糕

if (1 == 1)
return;
Run Code Online (Sandbox Code Playgroud)

我试图在VS Code中获得相同的行为.我无法看到为此设置或扩展.请帮忙.如果我必须进行扩展,或更新VS代码源并自行构建,我就是为此,请指出正确的方向.这很烦人.

Ale*_*lex 3

您可以创建代码片段。F1“usn” => 选择语言 >>

"if": {
    "prefix": "if",
    "body": [
        "if ($1)",
        "\t$2",
        "$3"
    ]
},
"ifelse": {
    "prefix": "ifelse",
    "body": [
        "if ($1)",
        "\t$2",
        "else",
        "\t$3",
        "$4"
    ]
},
Run Code Online (Sandbox Code Playgroud)

以防万一将其添加到settings.json ctrl+ ,

"editor.snippetSuggestions": "top",