mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] Provide instructions on how to switch to K2 mode when running a debug instance of IJ
#KTIJ-31127 GitOrigin-RevId: d80ea27b9aea7be5485a843452d4d30cee03ef21
This commit is contained in:
committed by
intellij-monorepo-bot
parent
065f712b62
commit
ca17e28672
@@ -10,4 +10,5 @@ label.your.current.plugin=Current Kotlin Mode is <b>{0}</b>
|
||||
link.label.cancel.switching=Cancel switching
|
||||
checkbox.enable.k2.based.kotlin.plugin=Enable K2 mode
|
||||
text.k2.based.kotlin.plugin=K2 mode brings stability and code analysis improvements. Some functionality is still a work in progress and will be supported as soon as it\u2019s ready. Read more <a href="https://blog.jetbrains.com/idea/2024/08/meet-the-renovated-kotlin-support-k2-mode/">here</a>.
|
||||
text.k2.based.kotlin.plugin.vmoptions.are.not.writable.0.1=You are running a debug instance of IntelliJ IDEA.<br>To switch to {1,choice,1#K1|2#K2} mode, please manually set the VM Option to<br><b>{0}{1,choice,1#false|2#true}</b>
|
||||
kotlin.language.configurable=Kotlin
|
||||
|
||||
+39
-25
@@ -66,23 +66,25 @@ class KotlinPluginKindSwitcherController {
|
||||
)
|
||||
text(text)
|
||||
}
|
||||
row {
|
||||
val text = KotlinPreferencesBundle.message(
|
||||
"label.plugin.will.be.switched.after.ide.restart",
|
||||
currentPluginMode.other.pluginModeDescription,
|
||||
)
|
||||
text(text)
|
||||
}
|
||||
row {
|
||||
link(
|
||||
IdeBundle.message("dialog.message.must.be.restarted.for.changes.to.take.effect", productName)
|
||||
) {
|
||||
suggestRestart(productName)
|
||||
if (VMOptions.canWriteOptions()) {
|
||||
row {
|
||||
val text = KotlinPreferencesBundle.message(
|
||||
"label.plugin.will.be.switched.after.ide.restart",
|
||||
currentPluginMode.other.pluginModeDescription,
|
||||
)
|
||||
text(text)
|
||||
}
|
||||
}
|
||||
row {
|
||||
link(KotlinPreferencesBundle.message("link.label.cancel.switching")) {
|
||||
cancelSwitching()
|
||||
row {
|
||||
link(
|
||||
IdeBundle.message("dialog.message.must.be.restarted.for.changes.to.take.effect", productName)
|
||||
) {
|
||||
suggestRestart(productName)
|
||||
}
|
||||
}
|
||||
row {
|
||||
link(KotlinPreferencesBundle.message("link.label.cancel.switching")) {
|
||||
cancelSwitching()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,12 +92,27 @@ class KotlinPluginKindSwitcherController {
|
||||
row {
|
||||
checkBox(KotlinPreferencesBundle.message("checkbox.enable.k2.based.kotlin.plugin")).also {
|
||||
checkBox = it.component
|
||||
enabled(VMOptions.canWriteOptions())
|
||||
}.onChanged {
|
||||
chosenKind = KotlinPluginMode.of(it.isSelected)
|
||||
}.gap(RightGap.SMALL)
|
||||
icon(AllIcons.General.Beta).align(AlignY.BOTTOM)
|
||||
updateCheckBoxToChosenKind()
|
||||
comment(KotlinPreferencesBundle.message("kotlin.plugin.type.restart.required.comment"))
|
||||
if (VMOptions.canWriteOptions()) {
|
||||
comment(KotlinPreferencesBundle.message("kotlin.plugin.type.restart.required.comment"))
|
||||
}
|
||||
}
|
||||
|
||||
if (!VMOptions.canWriteOptions()) {
|
||||
row {
|
||||
icon(AllIcons.General.Warning).align(AlignY.TOP).gap(rightGap = RightGap.SMALL)
|
||||
text(
|
||||
KotlinPreferencesBundle.message(
|
||||
"text.k2.based.kotlin.plugin.vmoptions.are.not.writable.0.1",
|
||||
USE_K2_PLUGIN_VM_OPTION_PREFIX,
|
||||
1.takeIf { useK2Plugin == true } ?: 2)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
row {
|
||||
@@ -122,21 +139,18 @@ class KotlinPluginKindSwitcherController {
|
||||
}
|
||||
|
||||
private fun updatePanels() {
|
||||
currentPluginPanel.visible(pluginKindWillBeSwitchedAfterRestart)
|
||||
pluginTypeChooserPanel.visible(!pluginKindWillBeSwitchedAfterRestart)
|
||||
val visible = VMOptions.canWriteOptions() && pluginKindWillBeSwitchedAfterRestart
|
||||
currentPluginPanel.visible(visible)
|
||||
pluginTypeChooserPanel.visible(!visible)
|
||||
}
|
||||
|
||||
private fun updateCheckBoxToChosenKind() {
|
||||
checkBox.isSelected = chosenKind == KotlinPluginMode.K2
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
|
||||
fun createIfPluginSwitchIsPossible(): KotlinPluginKindSwitcherController? {
|
||||
return if (VMOptions.canWriteOptions()) KotlinPluginKindSwitcherController()
|
||||
else null
|
||||
}
|
||||
fun createIfPluginSwitchIsPossible(): KotlinPluginKindSwitcherController? = KotlinPluginKindSwitcherController()
|
||||
|
||||
fun suggestRestart(productName: String) {
|
||||
val application = ApplicationManager.getApplication() as ApplicationEx
|
||||
@@ -159,7 +173,7 @@ class KotlinPluginKindSwitcherController {
|
||||
const val USE_K2_PLUGIN_VM_OPTION_PREFIX: @NonNls String = "-D$USE_K2_PLUGIN_PROPERTY_NAME="
|
||||
|
||||
private var useK2Plugin: Boolean?
|
||||
get() = VMOptions.readOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, /*effective=*/ false)?.toBoolean()
|
||||
get() = VMOptions.readOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, /*effective=*/ KotlinPluginModeProvider.isK2Mode())?.toBoolean()
|
||||
set(value) {
|
||||
VMOptions.setOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, value?.toString())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user