IDEA-279441 Port Code Completion to new UI DSL

GitOrigin-RevId: 9b1d66fed3992c3f7aee01cc468e447defde67f1
This commit is contained in:
Pavel Porvatov
2021-10-01 17:00:23 +00:00
committed by intellij-monorepo-bot
parent c0bc9b6a97
commit 1ea86f02a0
11 changed files with 224 additions and 147 deletions
@@ -4,24 +4,21 @@ package com.intellij.application.options
import com.intellij.application.options.editor.AutoImportOptionsConfigurable
import com.intellij.ide.DataManager
import com.intellij.java.JavaBundle
import com.intellij.openapi.options.UnnamedConfigurable
import com.intellij.openapi.options.UiDslUnnamedConfigurable
import com.intellij.openapi.options.ex.Settings
import com.intellij.ui.components.ActionLink
import javax.swing.JComponent
import com.intellij.ui.dsl.builder.Panel
class JavaCompletionConfigurable : UnnamedConfigurable {
override fun createComponent(): JComponent {
return ActionLink(JavaBundle.message("link.configure.classes.excluded.from.completion")) {
val dataContext = DataManager.getInstance().getDataContext(it.source as ActionLink)
val settingsEditor = dataContext.getData(Settings.KEY) ?: return@ActionLink
val configurable = settingsEditor.find(AutoImportOptionsConfigurable::class.java) ?: return@ActionLink
settingsEditor.select(configurable, JavaBundle.message("exclude.from.completion.group"))
class JavaCompletionConfigurable : UiDslUnnamedConfigurable.Simple() {
override fun Panel.createContent() {
row {
link(JavaBundle.message("link.configure.classes.excluded.from.completion")) {
val dataContext = DataManager.getInstance().getDataContext(it.source as ActionLink)
val settingsEditor = dataContext.getData(Settings.KEY) ?: return@link
val configurable = settingsEditor.find(AutoImportOptionsConfigurable::class.java) ?: return@link
settingsEditor.select(configurable, JavaBundle.message("exclude.from.completion.group"))
}
}
}
override fun isModified(): Boolean = false
override fun apply() {
}
}
@@ -746,8 +746,8 @@ editor.options.highlight.modified.line.error.stripe=Highlight modified lines in
editor.options.whitespace.line.color=Highlight lines with whitespace-only modifications with a different color
editor.options.tooltip.delay=Tooltip delay:
editor.options.ms=milliseconds
completion.option.match.case=Match case:
completion.option.first.letter.only=First letter only
completion.option.match.case=Match case:
completion.option.first.letter.only=First letter only
completion.option.all.letters=All letters
completion.option.sort.suggestions.alphabetically=Sort suggestions alphabetically
console.fold.console.lines=Fold console lines that contain:
@@ -23,8 +23,10 @@ import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.IdeUICustomization
import com.intellij.ui.components.JBCheckBox
import com.intellij.ui.components.JBRadioButton
import com.intellij.ui.dsl.builder.*
import com.intellij.ui.dsl.builder.Cell
import com.intellij.ui.dsl.builder.panel
import com.intellij.ui.layout.*
import com.intellij.util.ui.JBUI
class CodeCompletionConfigurable : BoundCompositeConfigurable<UnnamedConfigurable>(
ApplicationBundle.message("title.code.completion"), "reference.settingsdialog.IDE.editor.code.completion"),
@@ -106,13 +108,14 @@ class CodeCompletionConfigurable : BoundCompositeConfigurable<UnnamedConfigurabl
return panel {
buttonGroup {
fullRow {
cbMatchCase = checkBox(ApplicationBundle.message("completion.option.match.case")).component
row {
cbMatchCase = checkBox(ApplicationBundle.message("completion.option.match.case"))
.component
rbLettersOnly = radioButton(ApplicationBundle.message("completion.option.first.letter.only"))
.enableIf(cbMatchCase.selected)
.enabledIf(cbMatchCase.selected)
.component.apply { isSelected = true }
rbAllOnly = radioButton(ApplicationBundle.message("completion.option.all.letters"))
.enableIf(cbMatchCase.selected)
.enabledIf(cbMatchCase.selected)
.component
}
}
@@ -121,83 +124,84 @@ class CodeCompletionConfigurable : BoundCompositeConfigurable<UnnamedConfigurabl
val smartTypeCompletion = OptionsApplicabilityFilter.isApplicable(OptionId.COMPLETION_SMART_TYPE)
if (codeCompletion || smartTypeCompletion) {
row {
label(ApplicationBundle.message("label.autocomplete.when.only.one.choice"))
buttonGroup(ApplicationBundle.message("label.autocomplete.when.only.one.choice")) {
if (codeCompletion) {
fullRow {
checkBox(ApplicationBundle.message("checkbox.autocomplete.basic"), prop = settings::AUTOCOMPLETE_ON_CODE_COMPLETION)
label(KeymapUtil.getFirstKeyboardShortcutText(actionManager.getAction(IdeActions.ACTION_CODE_COMPLETION)))
.component.foreground = JBUI.CurrentTheme.ContextHelp.FOREGROUND
row {
checkBox(ApplicationBundle.message("checkbox.autocomplete.basic"))
.bindSelected(settings::AUTOCOMPLETE_ON_CODE_COMPLETION)
.gap(RightGap.SMALL)
comment(KeymapUtil.getFirstKeyboardShortcutText(actionManager.getAction(IdeActions.ACTION_CODE_COMPLETION)))
}
}
if (smartTypeCompletion) {
fullRow {
checkBox(ApplicationBundle.message("checkbox.autocomplete.smart.type"),
prop = settings::AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION)
label(KeymapUtil.getFirstKeyboardShortcutText(actionManager.getAction(IdeActions.ACTION_SMART_TYPE_COMPLETION)))
.component.foreground = JBUI.CurrentTheme.ContextHelp.FOREGROUND
row {
checkBox(ApplicationBundle.message("checkbox.autocomplete.smart.type"))
.bindSelected(settings::AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION)
.gap(RightGap.SMALL)
comment(KeymapUtil.getFirstKeyboardShortcutText(actionManager.getAction(IdeActions.ACTION_SMART_TYPE_COMPLETION)))
}
}
}
}
row {
checkBox(ApplicationBundle.message("completion.option.sort.suggestions.alphabetically"),
prop = instance::sortLookupElementsLexicographically)
checkBox(ApplicationBundle.message("completion.option.sort.suggestions.alphabetically"))
.bindSelected(instance::sortLookupElementsLexicographically)
}
lateinit var cbAutocompletion: CellBuilder<JBCheckBox>
lateinit var cbAutocompletion: Cell<JBCheckBox>
row {
cbAutocompletion = checkBox(ApplicationBundle.message("editbox.auto.complete") +
if (PowerSaveMode.isEnabled()) LangBundle.message("label.not.available.in.power.save.mode") else "",
prop = settings::AUTO_POPUP_COMPLETION_LOOKUP)
if (PowerSaveMode.isEnabled()) LangBundle.message("label.not.available.in.power.save.mode") else "")
.bindSelected(settings::AUTO_POPUP_COMPLETION_LOOKUP)
}
row {
indent {
row {
checkBox(IdeUICustomization.getInstance().selectAutopopupByCharsText,
getter = settings::isSelectAutopopupSuggestionsByChars,
setter = settings::setSelectAutopopupSuggestionsByChars)
.enableIf(cbAutocompletion.selected)
checkBox(IdeUICustomization.getInstance().selectAutopopupByCharsText)
.bindSelected(settings::isSelectAutopopupSuggestionsByChars, settings::setSelectAutopopupSuggestionsByChars)
.enabledIf(cbAutocompletion.selected)
}
}
fullRow {
val cbAutopopupJavaDoc = checkBox(ApplicationBundle.message("editbox.autopopup.javadoc.in"),
prop = settings::AUTO_POPUP_JAVADOC_INFO)
intTextField(prop = settings::JAVADOC_INFO_DELAY,
columns = 4,
range = CodeInsightSettings.JAVADOC_INFO_DELAY_RANGE.asRange(),
step = 100)
.enableIf(cbAutopopupJavaDoc.selected)
row {
val cbAutopopupJavaDoc = checkBox(ApplicationBundle.message("editbox.autopopup.javadoc.in"))
.bindSelected(settings::AUTO_POPUP_JAVADOC_INFO)
.gap(RightGap.SMALL)
intTextField(CodeInsightSettings.JAVADOC_INFO_DELAY_RANGE.asRange(), 100)
.bindIntText(settings::JAVADOC_INFO_DELAY)
.columns(4)
.enabledIf(cbAutopopupJavaDoc.selected)
.gap(RightGap.SMALL)
label(ApplicationBundle.message("editbox.ms"))
}
addOptions()
titledRow(ApplicationBundle.message("title.parameter.info")) {
group(ApplicationBundle.message("title.parameter.info")) {
if (OptionsApplicabilityFilter.isApplicable(OptionId.SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION)) {
row {
checkBox(ApplicationBundle.message("editbox.complete.with.parameters"),
prop = settings::SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION)
checkBox(ApplicationBundle.message("editbox.complete.with.parameters"))
.bindSelected(settings::SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION)
}
}
fullRow {
val cbParameterInfoPopup = checkBox(ApplicationBundle.message("editbox.autopopup.in"), prop = settings::AUTO_POPUP_PARAMETER_INFO)
intTextField(prop = settings::PARAMETER_INFO_DELAY,
columns = 4,
range = CodeInsightSettings.PARAMETER_INFO_DELAY_RANGE.asRange(),
step = 100)
.enableIf(cbParameterInfoPopup.selected)
row {
val cbParameterInfoPopup = checkBox(ApplicationBundle.message("editbox.autopopup.in"))
.bindSelected(settings::AUTO_POPUP_PARAMETER_INFO)
.gap(RightGap.SMALL)
intTextField(CodeInsightSettings.PARAMETER_INFO_DELAY_RANGE.asRange(), 100)
.bindIntText(settings::PARAMETER_INFO_DELAY)
.columns(4)
.enabledIf(cbParameterInfoPopup.selected)
.gap(RightGap.SMALL)
label(ApplicationBundle.message("editbox.ms"))
}
row {
checkBox(ApplicationBundle.message("checkbox.show.full.signatures"), prop = settings::SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO)
checkBox(ApplicationBundle.message("checkbox.show.full.signatures"))
.bindSelected(settings::SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO)
}
}
@@ -205,16 +209,16 @@ class CodeCompletionConfigurable : BoundCompositeConfigurable<UnnamedConfigurabl
}
}
private fun RowBuilder.addOptions() {
private fun Panel.addOptions() {
configurables.filter { it !is CodeCompletionOptionsCustomSection }
.forEach { appendDslConfigurableRow(it) }
.forEach { appendDslConfigurable(it) }
}
private fun RowBuilder.addSections() {
private fun Panel.addSections() {
configurables.filterIsInstance<CodeCompletionOptionsCustomSection>()
.sortedWith(Comparator.comparing { c ->
(c as? Configurable)?.displayName ?: ""
})
.forEach { appendDslConfigurableRow(it) }
.forEach { appendDslConfigurable(it) }
}
}
@@ -2,6 +2,8 @@
package com.intellij.openapi.options
import com.intellij.openapi.util.NlsContexts
import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.dsl.gridLayout.HorizontalAlign
import com.intellij.ui.layout.*
abstract class BoundCompositeConfigurable<T : UnnamedConfigurable>(
@@ -13,7 +15,7 @@ abstract class BoundCompositeConfigurable<T : UnnamedConfigurable>(
private val lazyConfigurables: Lazy<List<T>> = lazy { createConfigurables() }
protected val configurables get() = lazyConfigurables.value
private val plainConfigurables get() = lazyConfigurables.value.filter { it !is UiDslConfigurable }
private val plainConfigurables get() = lazyConfigurables.value.filter { it !is UiDslConfigurable && it !is UiDslUnnamedConfigurable }
override fun isModified(): Boolean {
return super.isModified() || plainConfigurables.any { it.isModified }
@@ -59,6 +61,24 @@ abstract class BoundCompositeConfigurable<T : UnnamedConfigurable>(
}
}
}
protected fun Panel.appendDslConfigurable(configurable: UnnamedConfigurable) {
if (configurable is UiDslUnnamedConfigurable) {
val builder = this
with(configurable) {
builder.createContent()
}
}
else {
val panel = configurable.createComponent()
if (panel != null) {
row {
cell(panel)
.horizontalAlign(HorizontalAlign.FILL)
}
}
}
}
}
abstract class BoundCompositeSearchableConfigurable<T : UnnamedConfigurable>(@NlsContexts.ConfigurableName displayName: String, helpTopic: String, private val _id: String = helpTopic)
@@ -3,7 +3,10 @@ package com.intellij.openapi.options
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.layout.*
import org.jetbrains.annotations.ApiStatus
@Deprecated(message = "Use new UI DSL com.intellij.ui.dsl and UiDslUnnamedConfigurable instead")
@ApiStatus.ScheduledForRemoval(inVersion = "2022.2")
interface UiDslConfigurable : UnnamedConfigurable {
fun RowBuilder.createComponentRow()
@@ -0,0 +1,31 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.options
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.dsl.builder.panel
interface UiDslUnnamedConfigurable : UnnamedConfigurable {
/**
* Creates content of configurable. Use [Panel.group] or [Panel.panel] as first element to avoid interference with parent grid and
* its content
*/
fun Panel.createContent()
/**
* Methods [isModified], [reset], [apply] and [disposeUIResources] are final because they are never called for [UiDslUnnamedConfigurable]
*/
abstract class Simple : DslConfigurableBase(), UiDslUnnamedConfigurable {
final override fun createPanel(): DialogPanel {
return panel {
createContent()
}
}
final override fun isModified() = super.isModified()
final override fun reset() = super<DslConfigurableBase>.reset()
final override fun apply() = super.apply()
final override fun disposeUIResources() = super<DslConfigurableBase>.disposeUIResources()
}
}
@@ -96,11 +96,17 @@ interface Panel : CellBase<Panel> {
bottomGroupGap: Boolean? = null,
init: Panel.() -> Unit): CollapsiblePanel
/**
* See documentation of overloaded buttonGroup method
*/
fun buttonGroup(@NlsContexts.BorderTitle title: String? = null, indent: Boolean = true, init: Panel.() -> Unit)
/**
* Unions [Row.radioButton] in one group. Must be also used for [Row.checkBox] if they are grouped with some title.
* Note that [Panel.group] provides different gaps around the title
*/
fun <T> buttonGroup(binding: PropertyBinding<T>, type: Class<T>, @NlsContexts.BorderTitle title: String? = null, init: Panel.() -> Unit)
fun <T> buttonGroup(binding: PropertyBinding<T>, type: Class<T>, @NlsContexts.BorderTitle title: String? = null, indent: Boolean = true,
init: Panel.() -> Unit)
fun onApply(callback: () -> Unit): Panel
@@ -6,6 +6,7 @@ import com.intellij.ui.dsl.builder.SpacingConfiguration
import com.intellij.util.SmartList
import com.intellij.util.ui.JBUI
import org.jetbrains.annotations.ApiStatus
import javax.swing.ButtonGroup
import javax.swing.JComponent
@ApiStatus.Internal
@@ -48,17 +49,17 @@ private fun createIntelliJSpacingConfiguration(): SpacingConfiguration {
internal class Context {
private val buttonGroupsStack: MutableList<BindButtonGroup<*>> = mutableListOf()
private val buttonGroupsStack: MutableList<ButtonGroup> = mutableListOf()
fun addButtonGroup(buttonGroup: BindButtonGroup<*>) {
fun addButtonGroup(buttonGroup: ButtonGroup) {
buttonGroupsStack.add(buttonGroup)
}
fun getButtonGroup(): BindButtonGroup<*>? {
fun getButtonGroup(): ButtonGroup? {
return buttonGroupsStack.lastOrNull()
}
fun removeLastButtonGroup() {
buttonGroupsStack.removeLast()
}
}
}
@@ -15,6 +15,7 @@ import com.intellij.ui.dsl.gridLayout.HorizontalAlign
import com.intellij.ui.dsl.gridLayout.VerticalAlign
import com.intellij.ui.layout.*
import org.jetbrains.annotations.ApiStatus
import javax.swing.ButtonGroup
import javax.swing.JComponent
import javax.swing.JLabel
@@ -212,24 +213,13 @@ internal open class PanelImpl(private val dialogPanelConfig: DialogPanelConfig,
return result
}
override fun <T> buttonGroup(binding: PropertyBinding<T>, type: Class<T>, @NlsContexts.BorderTitle title: String?, init: Panel.() -> Unit) {
dialogPanelConfig.context.addButtonGroup(BindButtonGroup(binding, type))
try {
if (title == null) {
init()
}
else {
val row = row {
label(title)
.applyToComponent { putClientProperty(DSL_LABEL_NO_BOTTOM_GAP_PROPERTY, true) }
}
row.internalBottomGap = dialogPanelConfig.spacing.buttonGroupHeaderBottomGap
indent(init)
}
}
finally {
dialogPanelConfig.context.removeLastButtonGroup()
}
override fun buttonGroup(title: String?, indent: Boolean, init: Panel.() -> Unit) {
buttonGroup(ButtonGroup(), title, indent, init)
}
override fun <T> buttonGroup(binding: PropertyBinding<T>, type: Class<T>, @NlsContexts.BorderTitle title: String?, indent: Boolean,
init: Panel.() -> Unit) {
buttonGroup(BindButtonGroup(binding, type), title, indent, init)
}
override fun onApply(callback: () -> Unit): PanelImpl {
@@ -378,6 +368,31 @@ internal open class PanelImpl(private val dialogPanelConfig: DialogPanelConfig,
row.bottomGap(if (bottomGap) BottomGap.MEDIUM else BottomGap.NONE)
}
}
private fun buttonGroup(buttonGroup: ButtonGroup, @NlsContexts.BorderTitle title: String?, indent: Boolean, init: Panel.() -> Unit) {
dialogPanelConfig.context.addButtonGroup(buttonGroup)
try {
if (title == null) {
init()
}
else {
val row = row {
label(title)
.applyToComponent { putClientProperty(DSL_LABEL_NO_BOTTOM_GAP_PROPERTY, true) }
}
row.internalBottomGap = dialogPanelConfig.spacing.buttonGroupHeaderBottomGap
if (indent) {
indent(init)
}
else {
init()
}
}
}
finally {
dialogPanelConfig.context.removeLastButtonGroup()
}
}
}
internal data class PanelContext(
@@ -94,11 +94,6 @@ internal class RowImpl(private val dialogPanelConfig: DialogPanelConfig,
override fun <T : JComponent> cell(component: T, viewComponent: JComponent): CellImpl<T> {
val result = CellImpl(dialogPanelConfig, component, this, viewComponent)
cells.add(result)
if (component is JRadioButton) {
dialogPanelConfig.context.getButtonGroup()?.add(component)
}
return result
}
@@ -182,19 +177,30 @@ internal class RowImpl(private val dialogPanelConfig: DialogPanelConfig,
}
override fun radioButton(text: String): Cell<JBRadioButton> {
return cell(JBRadioButton(text))
val group = dialogPanelConfig.context.getButtonGroup() ?: throw UiDslException(
"Button group must be defined before using radio button")
if (group is BindButtonGroup<*>) {
throw UiDslException("Parent button group provides binding but value for radioButton is not provided")
}
val result = cell(JBRadioButton(text))
group.add(result.component)
return result
}
override fun radioButton(text: String, value: Any): Cell<JBRadioButton> {
val group = dialogPanelConfig.context.getButtonGroup() ?: throw UiDslException(
"Button group must be defined before using radio button with value")
if (group !is BindButtonGroup<*>) {
throw UiDslException("Parent button group doesn't provide binding for $value")
}
if (value::class.java != group.type) {
throw UiDslException("Value $value is incompatible with button group binding class ${group.type.simpleName}")
}
val binding = group.binding
val result = radioButton(text)
result.component.isSelected = binding.get() == value
val result = cell(JBRadioButton(text))
val component = result.component
group.add(component)
component.isSelected = binding.get() == value
result.onApply { if (component.isSelected) group.set(value) }
result.onReset { component.isSelected = binding.get() == value }
result.onIsModified { component.isSelected != (binding.get() == value) }
@@ -1,23 +1,22 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.completion.ml.settings
import com.intellij.internal.ml.completion.RankingModelProvider
import com.intellij.completion.ml.CompletionMlRankingIcons
import com.intellij.completion.ml.MLCompletionBundle
import com.intellij.openapi.options.BoundConfigurable
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.ContextHelpLabel
import com.intellij.internal.ml.completion.RankingModelProvider
import com.intellij.openapi.options.Configurable
import com.intellij.openapi.options.UiDslUnnamedConfigurable
import com.intellij.ui.IconManager
import com.intellij.ui.components.JBCheckBox
import com.intellij.ui.components.JBLabel
import com.intellij.ui.dsl.builder.*
import com.intellij.ui.icons.RowIcon
import com.intellij.ui.layout.*
import com.intellij.util.IconUtil
import com.intellij.completion.ml.CompletionMlRankingIcons
import java.awt.Rectangle
import javax.swing.Icon
class MLRankingConfigurable(private val availableProviders: List<RankingModelProvider>) :
BoundConfigurable(MLCompletionBundle.message("ml.completion.settings.group")) {
UiDslUnnamedConfigurable.Simple(), Configurable {
private val settings = CompletionMLRankingSettings.getInstance()
companion object {
@@ -34,48 +33,43 @@ class MLRankingConfigurable(private val availableProviders: List<RankingModelPro
private fun cropIcon(icon: Icon): Icon = IconUtil.cropIcon(icon, Rectangle(4, 0, 8, 16))
}
override fun createPanel(): DialogPanel {
override fun getDisplayName(): String {
return MLCompletionBundle.message("ml.completion.settings.group")
}
override fun Panel.createContent() {
val providers = availableProviders.distinctBy { it.displayNameInSettings }.sortedBy { it.displayNameInSettings }
return panel {
var enableRankingCheckbox: CellBuilder<JBCheckBox>? = null
titledRow(displayName) {
row {
cell {
enableRankingCheckbox = checkBox(MLCompletionBundle.message("ml.completion.enable"), settings::isRankingEnabled,
{ settings.isRankingEnabled = it })
ContextHelpLabel.create(MLCompletionBundle.message("ml.completion.enable.help"))()
}
for (ranker in providers) {
row {
enableRankingCheckbox?.let { enableRanking ->
checkBox(ranker.displayNameInSettings, { settings.isLanguageEnabled(ranker.id) },
{ settings.setLanguageEnabled(ranker.id, it) })
.enableIf(enableRanking.selected)
}
}.apply { if (ranker === providers.last()) largeGapAfter() }
}
}
row {
cell {
enableRankingCheckbox?.let { enableRanking ->
checkBox(MLCompletionBundle.message("ml.completion.show.diff"),
{ settings.isShowDiffEnabled },
{ settings.isShowDiffEnabled = it }).enableIf(enableRanking.selected)
JBLabel(UP_DOWN_ICON)()
}
}
}
row {
cell {
enableRankingCheckbox?.let { enableRanking ->
checkBox(MLCompletionBundle.message("ml.completion.decorate.relevant"),
{ settings.isDecorateRelevantEnabled },
{ settings.isDecorateRelevantEnabled = it }).enableIf(enableRanking.selected)
JBLabel(RELEVANT_ICON)()
}
}
lateinit var enableRankingCheckbox: Cell<JBCheckBox>
group(displayName) {
row {
enableRankingCheckbox = checkBox(MLCompletionBundle.message("ml.completion.enable"))
.bindSelected({ settings.isRankingEnabled }, { settings.isRankingEnabled = it })
.gap(RightGap.SMALL)
contextHelp(MLCompletionBundle.message("ml.completion.enable.help"))
}
indent {
for (ranker in providers) {
row {
checkBox(ranker.displayNameInSettings)
.bindSelected({ settings.isLanguageEnabled(ranker.id) }, { settings.setLanguageEnabled(ranker.id, it) })
.enabledIf(enableRankingCheckbox.selected)
}.apply { if (ranker === providers.last()) bottomGap(BottomGap.SMALL) }
}
}
row {
checkBox(MLCompletionBundle.message("ml.completion.show.diff"))
.bindSelected({ settings.isShowDiffEnabled }, { settings.isShowDiffEnabled = it })
.enabledIf(enableRankingCheckbox.selected)
.gap(RightGap.SMALL)
icon(UP_DOWN_ICON)
}
row {
checkBox(MLCompletionBundle.message("ml.completion.decorate.relevant"))
.bindSelected({ settings.isDecorateRelevantEnabled }, { settings.isDecorateRelevantEnabled = it })
.enabledIf(enableRankingCheckbox.selected)
.gap(RightGap.SMALL)
icon(RELEVANT_ICON)
}
}
}
}