Skip to content

Commit 72e1123

Browse files
committed
Add Option to add Space Before Lambda Empty Parenthesis
This change introduces a dedicated formatter option to control spacing before lambda empty parameter parentheses. Lambda formatting is now handled independently, ensuring method declaration settings no longer affect lambda expressions.
1 parent 90d2d96 commit 72e1123

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -531,6 +531,7 @@ private FormatterMessages() {
531531
public static String ModifyDialogTabPage_error_msg_values_items_text_unassigned;
532532
public static String ModifyDialogTabPage_NumberPreference_error_invalid_key;
533533
public static String ModifyDialogTabPage_NumberPreference_error_invalid_value;
534+
public static String FormatterModifyDialog_whiteSpace_pref_before_lambda_empty_param;
534535

535536
static {
536537
NLS.initializeMessages(BUNDLE_NAME, FormatterMessages.class);

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2000, 2025 IBM Corporation and others.
2+
# Copyright (c) 2000, 2026 IBM Corporation and others.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the Eclipse Public License 2.0
@@ -204,6 +204,7 @@ FormatterModifyDialog_whiteSpace_tree_records=Records
204204
FormatterModifyDialog_whiteSpace_tree_return='return'
205205
FormatterModifyDialog_whiteSpace_tree_throw='throw'
206206
FormatterModifyDialog_whiteSpace_tree_lambda=Lambda
207+
FormatterModifyDialog_whiteSpace_pref_before_lambda_empty_param=Before lambda empty parentheses
207208

208209

209210
FormatterModifyDialog_lineWrap_pref_catch='multi-catch'

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterModifyDialog.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -1128,7 +1128,8 @@ private void createWhiteSpaceTree() {
11281128
.pref(FormatterMessages.FormatterModifyDialog_whiteSpace_pref_before_opening_brace_in_record_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_RECORD_CONSTRUCTOR))
11291129
.node(fTree.builder(FormatterMessages.FormatterModifyDialog_whiteSpace_tree_lambda, "-lambdas", modAll) //$NON-NLS-1$
11301130
.pref(FormatterMessages.FormatterModifyDialog_whiteSpace_pref_before_arrow_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_LAMBDA_ARROW)
1131-
.pref(FormatterMessages.FormatterModifyDialog_whiteSpace_pref_after_arrow_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_LAMBDA_ARROW)))
1131+
.pref(FormatterMessages.FormatterModifyDialog_whiteSpace_pref_after_arrow_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_LAMBDA_ARROW)
1132+
.pref(FormatterMessages.FormatterModifyDialog_whiteSpace_pref_before_lambda_empty_param, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_LAMBDA_EMPTY_PARENTHESES)))
11321133
.node(fTree.builder(FormatterMessages.FormatterModifyDialog_whiteSpace_tree_statements, "-statements", modAll) //$NON-NLS-1$
11331134
.node(fTree.builder(FormatterMessages.FormatterModifyDialog_whiteSpace_tree_blocks, "-blocks", modAll) //$NON-NLS-1$
11341135
.pref(FormatterMessages.FormatterModifyDialog_whiteSpace_pref_before_opening_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK)

0 commit comments

Comments
 (0)