PY-90442 formatter: update names to match python

(cherry picked from commit 8a33f109ec6e821d2bbfa3d4b6d22997f33fce8e)

IJ-MR-209576

GitOrigin-RevId: cfde5b1056c8dc47ad9a3e3c7e7e429aa85e387e
This commit is contained in:
Morgan Bartholomew
2026-06-23 15:52:24 +00:00
committed by intellij-monorepo-bot
parent 7e62abf1c4
commit 5690e4e3d5
4 changed files with 19 additions and 111 deletions
@@ -42,10 +42,10 @@ formatter.panel.injected.fragments=Injected fragments:
formatter.panel.format.injected.fragments=Format injected fragments
formatter.panel.injected.fragments.use.continuation.indent=Add indent
formatter.panel.use.continuation.indent.for.title=Use continuation indent for
formatter.panel.use.continuation.indent.for.parameters=Method declaration parameters
formatter.panel.use.continuation.indent.for.arguments=Method call arguments
formatter.panel.use.continuation.indent.for.collection.literals=Collections and comprehensions
formatter.use.continuation.indent=Use continuation indent
formatter.function.declaration.parameters=Function declaration parameters
formatter.function.call.arguments=Function call arguments
configurable.PyLanguageCodeStyleSettingsProvider.display.name=Python
formatter.force.trailing.comma.if.multiline=Force trailing comma if multiline
@@ -108,6 +108,9 @@ public final class PyLanguageCodeStyleSettingsProvider extends LanguageCodeStyle
"METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE",
"ALIGN_MULTILINE_PARAMETERS_IN_CALLS");
consumer.renameStandardOption("METHOD_PARAMETERS_WRAP", PySyntaxBundle.message("formatter.function.declaration.parameters"));
consumer.renameStandardOption("CALL_PARAMETERS_WRAP", PySyntaxBundle.message("formatter.function.call.arguments"));
consumer.showCustomOption(PyCodeStyleSettings.class,
"USE_TRAILING_COMMA_IN_ARGUMENTS_LIST",
PySyntaxBundle.message("formatter.force.trailing.comma.if.multiline"),
@@ -118,6 +121,18 @@ public final class PyLanguageCodeStyleSettingsProvider extends LanguageCodeStyle
PySyntaxBundle.message("formatter.force.trailing.comma.if.multiline"),
ApplicationBundle.message("wrapping.method.parameters"));
// "Use continuation indent" checkboxes
consumer.showCustomOption(PyCodeStyleSettings.class, "USE_CONTINUATION_INDENT_FOR_PARAMETERS",
PySyntaxBundle.message("formatter.use.continuation.indent"),
getInstance().WRAPPING_METHOD_PARAMETERS);
consumer.showCustomOption(PyCodeStyleSettings.class, "USE_CONTINUATION_INDENT_FOR_ARGUMENTS",
PySyntaxBundle.message("formatter.use.continuation.indent"),
getInstance().WRAPPING_METHOD_ARGUMENTS_WRAPPING);
consumer.showCustomOption(PyCodeStyleSettings.class, "USE_CONTINUATION_INDENT_FOR_COLLECTION_AND_COMPREHENSIONS",
PySyntaxBundle.message("formatter.use.continuation.indent"),
PySyntaxBundle.message("formatter.collections.and.comprehensions"));
consumer.showCustomOption(PyCodeStyleSettings.class, "NEW_LINE_AFTER_COLON",
PySyntaxBundle.message("formatter.single.clause.statements"),
PySyntaxBundle.message("formatter.force.new.line.after.colon"));
@@ -55,43 +55,6 @@
</constraints>
<properties/>
</component>
<grid id="7c517" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/PySyntaxBundle" title-key="formatter.panel.use.continuation.indent.for.title"/>
<children>
<component id="9e329" class="com.intellij.ui.components.JBCheckBox" binding="myUseContinuationIndentForArguments" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/PySyntaxBundle" key="formatter.panel.use.continuation.indent.for.arguments"/>
</properties>
</component>
<component id="6f4f2" class="com.intellij.ui.components.JBCheckBox" binding="myUseContinuationIndentForParameters" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/PySyntaxBundle" key="formatter.panel.use.continuation.indent.for.parameters"/>
</properties>
</component>
<component id="44647" class="com.intellij.ui.components.JBCheckBox" binding="myUseContinuationIndentForCollectionsAndComprehensions">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/PySyntaxBundle" key="formatter.panel.use.continuation.indent.for.collection.literals"/>
</properties>
</component>
</children>
</grid>
<grid id="967d2" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
@@ -44,9 +44,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
private final JPanel myPanel;
private final JBCheckBox myAddTrailingBlankLineCheckbox;
private final JBCheckBox myUseContinuationIndentForParameters;
private final JBCheckBox myUseContinuationIndentForArguments;
private final JBCheckBox myUseContinuationIndentForCollectionsAndComprehensions;
private final ComboBox<DictAlignment> myDictAlignmentCombo;
private final JPanel myPreviewPanel;
private final JBCheckBox myFormatInjectedFragments;
@@ -92,37 +89,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
panel1.add(myDictAlignmentCombo, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
null, null, 0, false));
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
panel2.putClientProperty("BorderFactoryClass", "com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent");
panel1.add(panel2, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null,
0, false));
panel2.setBorder(IdeBorderFactory.PlainSmallWithIndent.createTitledBorder(BorderFactory.createEtchedBorder(),
this.$$$getMessageFromBundle$$$("messages/PySyntaxBundle",
"formatter.panel.use.continuation.indent.for.title"),
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, null, null));
myUseContinuationIndentForArguments = new JBCheckBox();
this.$$$loadButtonText$$$(myUseContinuationIndentForArguments, this.$$$getMessageFromBundle$$$("messages/PySyntaxBundle",
"formatter.panel.use.continuation.indent.for.arguments"));
panel2.add(myUseContinuationIndentForArguments,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myUseContinuationIndentForParameters = new JBCheckBox();
this.$$$loadButtonText$$$(myUseContinuationIndentForParameters, this.$$$getMessageFromBundle$$$("messages/PySyntaxBundle",
"formatter.panel.use.continuation.indent.for.parameters"));
panel2.add(myUseContinuationIndentForParameters,
new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myUseContinuationIndentForCollectionsAndComprehensions = new JBCheckBox();
this.$$$loadButtonText$$$(myUseContinuationIndentForCollectionsAndComprehensions,
this.$$$getMessageFromBundle$$$("messages/PySyntaxBundle",
"formatter.panel.use.continuation.indent.for.collection.literals"));
panel2.add(myUseContinuationIndentForCollectionsAndComprehensions,
new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
panel3.putClientProperty("BorderFactoryClass", "com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent");
@@ -169,20 +135,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
}
});
myUseContinuationIndentForParameters.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
somethingChanged();
}
});
myUseContinuationIndentForArguments.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
somethingChanged();
}
});
myFormatInjectedFragments.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -324,10 +276,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
}
}
myAddTrailingBlankLineCheckbox.setSelected(pySettings.BLANK_LINE_AT_FILE_END);
myUseContinuationIndentForParameters.setSelected(pySettings.USE_CONTINUATION_INDENT_FOR_PARAMETERS);
myUseContinuationIndentForArguments.setSelected(pySettings.USE_CONTINUATION_INDENT_FOR_ARGUMENTS);
myUseContinuationIndentForCollectionsAndComprehensions.setSelected(
pySettings.USE_CONTINUATION_INDENT_FOR_COLLECTION_AND_COMPREHENSIONS);
myFormatInjectedFragments.setSelected(pySettings.FORMAT_INJECTED_FRAGMENTS);
myAddIndentInsideInjections.setSelected(pySettings.ADD_INDENT_INSIDE_INJECTIONS);
}
@@ -337,9 +285,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
final PyCodeStyleSettings customSettings = getCustomSettings(settings);
customSettings.DICT_ALIGNMENT = getDictAlignmentAsInt();
customSettings.BLANK_LINE_AT_FILE_END = ensureTrailingBlankLine();
customSettings.USE_CONTINUATION_INDENT_FOR_PARAMETERS = useContinuationIndentForParameters();
customSettings.USE_CONTINUATION_INDENT_FOR_ARGUMENTS = useContinuationIndentForArguments();
customSettings.USE_CONTINUATION_INDENT_FOR_COLLECTION_AND_COMPREHENSIONS = useContinuationIndentForCollectionLiterals();
customSettings.FORMAT_INJECTED_FRAGMENTS = formatInjectedFragments();
customSettings.ADD_INDENT_INSIDE_INJECTIONS = addIndentInsideInjections();
}
@@ -349,9 +294,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
final PyCodeStyleSettings customSettings = getCustomSettings(settings);
return customSettings.DICT_ALIGNMENT != getDictAlignmentAsInt() ||
customSettings.BLANK_LINE_AT_FILE_END != ensureTrailingBlankLine() ||
customSettings.USE_CONTINUATION_INDENT_FOR_PARAMETERS != useContinuationIndentForParameters() ||
customSettings.USE_CONTINUATION_INDENT_FOR_ARGUMENTS != useContinuationIndentForArguments() ||
customSettings.USE_CONTINUATION_INDENT_FOR_COLLECTION_AND_COMPREHENSIONS != useContinuationIndentForCollectionLiterals() ||
customSettings.FORMAT_INJECTED_FRAGMENTS != formatInjectedFragments() ||
customSettings.ADD_INDENT_INSIDE_INJECTIONS != addIndentInsideInjections();
}
@@ -373,14 +315,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
return myAddTrailingBlankLineCheckbox.isSelected();
}
private boolean useContinuationIndentForParameters() {
return myUseContinuationIndentForParameters.isSelected();
}
private boolean useContinuationIndentForArguments() {
return myUseContinuationIndentForArguments.isSelected();
}
private boolean formatInjectedFragments() {
return myFormatInjectedFragments.isSelected();
}
@@ -389,10 +323,6 @@ public class PyOtherCodeStylePanel extends CodeStyleAbstractPanel {
return myAddIndentInsideInjections.isSelected();
}
protected boolean useContinuationIndentForCollectionLiterals() {
return myUseContinuationIndentForCollectionsAndComprehensions.isSelected();
}
public static final String PREVIEW = """
x = max(
1,