在大括号选项下,我已将所有属性设置为同一行。但是在“空行”选项中,要保留的空行数为1。这超越了我现有的财产。
预期:
public class SamplePreparedStatement {
public static void main(String[] args) throws SQLException {
实际
public class SamplePreparedStatement {
public static void main(String[] args) throws SQLException
{
设定:
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
答案 0 :(得分:1)
在eclipse菜单窗口中 - &gt;偏好 - &gt; Java - &gt;代码风格 - &gt;格式化程序
然后将您当前的物质导入日食并按照以下步骤操作。
窗口 - &gt;偏好 - &gt; Java - &gt;代码风格 - &gt;格式化器强>
然后点击编辑按钮,将打开一个小狗窗口。同样,它有多个标签点击大括号。
在哪个类或接口声明下会有一个下拉框,其中选择相同行选项。
然后保存您所反映的更改内容。