Set better defaults on Imports tab in Code Style -> Kotlin (KT-22575)
"Top level symbols" and "Java Statics and Enum Members" are always returned to 2 after saving to not-number option #KT-22575 Fixed
This commit is contained in:
+1
@@ -23,6 +23,7 @@ import com.intellij.util.ReflectionUtil;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class KotlinCodeStyleSettings extends CustomCodeStyleSettings {
|
public class KotlinCodeStyleSettings extends CustomCodeStyleSettings {
|
||||||
|
public static final KotlinCodeStyleSettings DEFAULT = new KotlinCodeStyleSettings(new CodeStyleSettings());
|
||||||
|
|
||||||
public final PackageEntryTable PACKAGES_TO_USE_STAR_IMPORTS = new PackageEntryTable();
|
public final PackageEntryTable PACKAGES_TO_USE_STAR_IMPORTS = new PackageEntryTable();
|
||||||
public boolean SPACE_AROUND_RANGE = false;
|
public boolean SPACE_AROUND_RANGE = false;
|
||||||
|
|||||||
@@ -69,8 +69,10 @@ class ImportSettingsPanel(private val commonSettings: CodeStyleSettings) : JPane
|
|||||||
}
|
}
|
||||||
private val starImportPackageTable = ImportLayoutPanel.createTableForPackageEntries(starImportPackageEntryTable, dummyImportLayoutPanel)
|
private val starImportPackageTable = ImportLayoutPanel.createTableForPackageEntries(starImportPackageEntryTable, dummyImportLayoutPanel)
|
||||||
|
|
||||||
private val nameCountToUseStarImportSelector = NameCountToUseStarImportSelector("Top-level Symbols")
|
private val nameCountToUseStarImportSelector = NameCountToUseStarImportSelector(
|
||||||
private val nameCountToUseStarImportForMembersSelector = NameCountToUseStarImportSelector("Java Statics and Enum Members")
|
"Top-level Symbols", KotlinCodeStyleSettings.DEFAULT.NAME_COUNT_TO_USE_STAR_IMPORT)
|
||||||
|
private val nameCountToUseStarImportForMembersSelector = NameCountToUseStarImportSelector(
|
||||||
|
"Java Statics and Enum Members", KotlinCodeStyleSettings.DEFAULT.NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
layout = BorderLayout()
|
layout = BorderLayout()
|
||||||
@@ -160,11 +162,11 @@ class ImportSettingsPanel(private val commonSettings: CodeStyleSettings) : JPane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NameCountToUseStarImportSelector(title: String) : OptionGroup(title) {
|
private class NameCountToUseStarImportSelector(title: String, default: Int) : OptionGroup(title) {
|
||||||
private val rbUseSingleImports = JRadioButton("Use single name import")
|
private val rbUseSingleImports = JRadioButton("Use single name import")
|
||||||
private val rbUseStarImports = JRadioButton("Use import with '*'")
|
private val rbUseStarImports = JRadioButton("Use import with '*'")
|
||||||
private val rbUseStarImportsIfAtLeast = JRadioButton("Use import with '*' when at least ")
|
private val rbUseStarImportsIfAtLeast = JRadioButton("Use import with '*' when at least ")
|
||||||
private val starImportLimitModel = SpinnerNumberModel(2, 2, 100, 1)
|
private val starImportLimitModel = SpinnerNumberModel(default, 2, 100, 1)
|
||||||
private val starImportLimitField = JSpinner(starImportLimitModel)
|
private val starImportLimitField = JSpinner(starImportLimitModel)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
Reference in New Issue
Block a user