gpt4 book ai didi

visual-studio-code - 如何停止VS Code,强制我使用花括号,否则光标位置变得疯狂(PHP或将其全局应用)

转载 作者:行者123 更新时间:2023-12-04 04:29:12 25 4
gpt4 key购买 nike

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?

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)

如果使用如下花括号,则在VS Code中这不是问题:
if (1 == 1){
return;
}

但是,我不喜欢在那种情况下使用花括号,如果不这样做,VS代码自然会让我最终写出这段代码,这也很糟糕
if (1 == 1)
return;

我正在尝试在VS Code中获得相同的行为。我看不到为此设置或扩展名。请帮忙。如果我必须进行扩展,或者自己更新VS Code源并自行构建,那么我会坚持的,请为我指出正确的方向。真烦人

最佳答案

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

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

以防万一,将其添加到 settings.json ctrl + ,:
"editor.snippetSuggestions": "top",

关于visual-studio-code - 如何停止VS Code,强制我使用花括号,否则光标位置变得疯狂(PHP或将其全局应用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44058830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com