我有以下代码:
DSPOTTGuaranteedUserReachForecastModel 模型 = 新的 DSPOTTGuaranteedUserReachForecastModel(模拟缓存,要求,mockTargetingDatabaseHelper,程序类型,地区);
正确的缩进应该是每个不完整行的两个缩进.理想情况下,我希望我的文本编辑器像这样格式化我的代码:
DSPOTTGuaranteedUserReachForecastModel 模型 = 新的 DSPOTTGuaranteedUserReachForecastModel(模拟缓存,要求,mockTargetingDatabaseHelper,程序类型,地区);
但是,当我尝试使用 VSCode 对其进行格式化时,我将所有新行合并成一个长行.
DSPOTTGuaranteedUserReachForecastModel 模型 = 新的 DSPOTTGuaranteedUserReachForecastModel(mockCache, 需求,mockTargetingDatabaseHelper,programType,区域);
有谁知道保留行号的规则的名称是什么?
关于java格式化,
I have the following code:
DSPOTTGuaranteedUserReachForecastModel model = new DSPOTTGuaranteedUserReachForecastModel(
mockCache,
demand,
mockTargetingDatabaseHelper,
programType,
region);
The correct indentation should be two indents for each incomplete line. Ideally I would want to my text editor to format my code as such:
DSPOTTGuaranteedUserReachForecastModel model = new DSPOTTGuaranteedUserReachForecastModel(
mockCache,
demand,
mockTargetingDatabaseHelper,
programType,
region);
However, when I try to format it using VSCode, I am getting all the new lines collapsing into one long line instead.
DSPOTTGuaranteedUserReachForecastModel model = new DSPOTTGuaranteedUserReachForecastModel(mockCache, demand,
mockTargetingDatabaseHelper, programType, region);
Does anyone know what is the name of the rule for preserving line numbers?
About java formatting, VSCode-Java provides an Eclipse formatter file like Google Style.
The setting you wanted should be something like java_method_parameters_wrap = split_into_lines
, but unfortunately it's not included in GoogleStyle.xml.
If you're still interested in java formatting, you may figure it out in DefaultCodeFormatterOptions.
[EDIT]
Download googlestyle.xml and edit the following settings:
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1" />
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
Then in vscode settings.json, set
"java.format.settings.url": "<local path to java-google-style.xml>",
You can get the formatting style that you want:
这篇关于Java 格式化:保留行但修复缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!