【发布时间】:2021-11-17 23:57:40
【问题描述】:
我正在键入一些类或方法,并使用换行符来帮助我查看所有内容的位置,并且在我保存时它不断被编辑掉。我尝试在扩展程序和设置中寻找答案,但无法弄清楚可能是什么删除了新行。
我会有类似的东西:
public class SomeClass
{
public static void main (String[] args)
{
Some code here;
}
}
它会删除 SomeClass 和 args 之后的第一个换行符) 它会将其编辑为如下所示:
public class SomeClass {
public static void main (String[] args) {
some code here;
}
}
如何关闭删除新行的保存编辑?
这里是 settings.json:
{
"files.autoSave": "afterDelay",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"editor.bracketPairColorization.enabled": true,
"editor.padding.bottom": 5,
"editor.padding.top": 5,
"editor.roundedSelection": false,
"javascript.format.placeOpenBraceOnNewLineForControlBlocks": true,
"javascript.format.placeOpenBraceOnNewLineForFunctions": true,
"files.insertFinalNewline": true,
"editor.renderFinalNewline": false,
"editor.trimAutoWhitespace": false,
"launch": {
"configurations": [],
"compounds": []
}
}
【问题讨论】:
-
你能分享来自 vs 代码的 settings.json 吗?
-
理想情况下,您应该遵循行业内一致的风格指南。在 Java 中,左括号永远不会在自己的行中
-
我同意@OneCricketeer,遵循 Java 代码约定。在新行上打开括号对 Java 程序员来说看起来很陌生
标签: java visual-studio-code vscode-settings