<bdo id='yJfQ8'></bdo><ul id='yJfQ8'></ul>
<legend id='yJfQ8'><style id='yJfQ8'><dir id='yJfQ8'><q id='yJfQ8'></q></dir></style></legend>

<small id='yJfQ8'></small><noframes id='yJfQ8'>

    1. <i id='yJfQ8'><tr id='yJfQ8'><dt id='yJfQ8'><q id='yJfQ8'><span id='yJfQ8'><b id='yJfQ8'><form id='yJfQ8'><ins id='yJfQ8'></ins><ul id='yJfQ8'></ul><sub id='yJfQ8'></sub></form><legend id='yJfQ8'></legend><bdo id='yJfQ8'><pre id='yJfQ8'><center id='yJfQ8'></center></pre></bdo></b><th id='yJfQ8'></th></span></q></dt></tr></i><div id='yJfQ8'><tfoot id='yJfQ8'></tfoot><dl id='yJfQ8'><fieldset id='yJfQ8'></fieldset></dl></div>
    2. <tfoot id='yJfQ8'></tfoot>

      Java 格式化:保留行但修复缩进

      时间:2023-09-29
      <tfoot id='jdQB6'></tfoot>
          <bdo id='jdQB6'></bdo><ul id='jdQB6'></ul>
          <i id='jdQB6'><tr id='jdQB6'><dt id='jdQB6'><q id='jdQB6'><span id='jdQB6'><b id='jdQB6'><form id='jdQB6'><ins id='jdQB6'></ins><ul id='jdQB6'></ul><sub id='jdQB6'></sub></form><legend id='jdQB6'></legend><bdo id='jdQB6'><pre id='jdQB6'><center id='jdQB6'></center></pre></bdo></b><th id='jdQB6'></th></span></q></dt></tr></i><div id='jdQB6'><tfoot id='jdQB6'></tfoot><dl id='jdQB6'><fieldset id='jdQB6'></fieldset></dl></div>

            <small id='jdQB6'></small><noframes id='jdQB6'>

                  <tbody id='jdQB6'></tbody>
                <legend id='jdQB6'><style id='jdQB6'><dir id='jdQB6'><q id='jdQB6'></q></dir></style></legend>
                本文介绍了Java 格式化:保留行但修复缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有以下代码:

                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模板网!

                上一篇:如何在android中提取这个字符串变量? 下一篇:如何告诉 Eclipse 不格式化代码文件的一部分(按

                相关文章

                最新文章

                • <bdo id='Oj9Uv'></bdo><ul id='Oj9Uv'></ul>

                  1. <i id='Oj9Uv'><tr id='Oj9Uv'><dt id='Oj9Uv'><q id='Oj9Uv'><span id='Oj9Uv'><b id='Oj9Uv'><form id='Oj9Uv'><ins id='Oj9Uv'></ins><ul id='Oj9Uv'></ul><sub id='Oj9Uv'></sub></form><legend id='Oj9Uv'></legend><bdo id='Oj9Uv'><pre id='Oj9Uv'><center id='Oj9Uv'></center></pre></bdo></b><th id='Oj9Uv'></th></span></q></dt></tr></i><div id='Oj9Uv'><tfoot id='Oj9Uv'></tfoot><dl id='Oj9Uv'><fieldset id='Oj9Uv'></fieldset></dl></div>

                    <small id='Oj9Uv'></small><noframes id='Oj9Uv'>

                    <tfoot id='Oj9Uv'></tfoot>

                    <legend id='Oj9Uv'><style id='Oj9Uv'><dir id='Oj9Uv'><q id='Oj9Uv'></q></dir></style></legend>