mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-28 04:37:32 +07:00
[Python] Refactor the old DictAlignment enum which prevented dynamic syntax bundle loading
Unfortunately, we need to keep the old int values logic to preserve compatibility with old user settings GitOrigin-RevId: 59fba8bd53e3d89d31897ed675b54827bbf9b15f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a4f9be714a
commit
f8a57f7367
+14
-8
@@ -4,6 +4,7 @@ package com.jetbrains.python.formatter;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
|
||||
import com.intellij.util.ui.PresentableEnum;
|
||||
import com.jetbrains.python.PySyntaxCoreBundle;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -13,24 +14,29 @@ import static com.intellij.psi.codeStyle.CommonCodeStyleSettings.WRAP_AS_NEEDED;
|
||||
|
||||
public class PyCodeStyleSettings extends CustomCodeStyleSettings {
|
||||
|
||||
public enum DictAlignment {
|
||||
NONE(PySyntaxCoreBundle.message("formatter.panel.dict.alignment.do.not.align")),
|
||||
ON_VALUE(PySyntaxCoreBundle.message("formatter.panel.dict.alignment.align.on.value")),
|
||||
ON_COLON(PySyntaxCoreBundle.message("formatter.panel.dict.alignment.align.on.colon"));
|
||||
public enum DictAlignment implements PresentableEnum {
|
||||
NONE("formatter.panel.dict.alignment.do.not.align"),
|
||||
ON_VALUE("formatter.panel.dict.alignment.align.on.value"),
|
||||
ON_COLON("formatter.panel.dict.alignment.align.on.colon");
|
||||
|
||||
String description;
|
||||
private final String key;
|
||||
|
||||
DictAlignment(String description) {
|
||||
this.description = description;
|
||||
DictAlignment(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPresentableText() {
|
||||
return PySyntaxCoreBundle.message(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return description;
|
||||
return getPresentableText();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user