mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[inlays] remove old inlay settings and deprecate still used methods
GitOrigin-RevId: 86f4005d3d7b4ab7804556fc1cb8f89bd556c70d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1af62f15f8
commit
0478550d2a
@@ -11,8 +11,8 @@ import com.intellij.codeInsight.codeVision.ui.model.richText.RichText
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
|
||||
import com.intellij.codeInsight.hints.InlayGroup
|
||||
import com.intellij.codeInsight.hints.codeVision.CodeVisionPassFactory
|
||||
import com.intellij.codeInsight.hints.settings.InlayHintsConfigurable
|
||||
import com.intellij.codeInsight.hints.settings.language.isInlaySettingsEditor
|
||||
import com.intellij.codeInsight.hints.settings.showInlaySettings
|
||||
import com.intellij.ide.plugins.DynamicPluginListener
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor
|
||||
import com.intellij.lang.Language
|
||||
@@ -521,10 +521,10 @@ open class CodeVisionHost(val project: Project) {
|
||||
}
|
||||
|
||||
protected open fun openCodeVisionSettings(groupId: String? = null) {
|
||||
InlayHintsConfigurable.showSettingsDialogForLanguage(project, Language.ANY) {
|
||||
if (groupId == null) return@showSettingsDialogForLanguage it.group == InlayGroup.CODE_VISION_GROUP_NEW
|
||||
showInlaySettings(project, Language.ANY) {
|
||||
if (groupId == null) return@showInlaySettings it.group == InlayGroup.CODE_VISION_GROUP_NEW
|
||||
|
||||
return@showSettingsDialogForLanguage it.group == InlayGroup.CODE_VISION_GROUP_NEW && it.id == groupId
|
||||
return@showInlaySettings it.group == InlayGroup.CODE_VISION_GROUP_NEW && it.id == groupId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -2,8 +2,8 @@
|
||||
package com.intellij.codeInsight.hints
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle
|
||||
import com.intellij.codeInsight.hints.settings.InlayHintsConfigurable
|
||||
import com.intellij.codeInsight.hints.settings.language.NewInlayProviderSettingsModel
|
||||
import com.intellij.codeInsight.hints.settings.showInlaySettings
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
@@ -83,7 +83,7 @@ internal class ConfigureInlayHintsProviderAction(
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val file = e.getData(PSI_FILE) ?: return
|
||||
|
||||
InlayHintsConfigurable.showSettingsDialogForLanguage(file.project, file.language) { it.id == providerKey.id }
|
||||
showInlaySettings(file.project, file.language) { it.id == providerKey.id }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,5 +92,4 @@ private fun disableInlayHintsProvider(key: SettingsKey<*>, language: Language) =
|
||||
|
||||
private fun refreshHints() {
|
||||
InlayHintsPassFactory.forceHintsUpdateOnNextPass()
|
||||
InlayHintsConfigurable.updateInlayHintsUI()
|
||||
}
|
||||
@@ -6,9 +6,9 @@ import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
|
||||
import com.intellij.codeInsight.daemon.impl.ParameterHintsPresentationManager
|
||||
import com.intellij.codeInsight.hints.HintInfo.MethodInfo
|
||||
import com.intellij.codeInsight.hints.settings.Diff
|
||||
import com.intellij.codeInsight.hints.settings.InlayHintsConfigurable
|
||||
import com.intellij.codeInsight.hints.settings.ParameterNameHintsSettings
|
||||
import com.intellij.codeInsight.hints.settings.language.ParameterInlayProviderSettingsModel
|
||||
import com.intellij.codeInsight.hints.settings.showInlaySettings
|
||||
import com.intellij.codeInsight.intention.HighPriorityAction
|
||||
import com.intellij.codeInsight.intention.IntentionAction
|
||||
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||
@@ -88,8 +88,7 @@ fun showParameterHintsDialog(e: AnActionEvent, getPattern: (HintInfo?) -> String
|
||||
val selectedLanguage = (info as? MethodInfo)?.language ?: fileLanguage
|
||||
|
||||
when (val pattern = getPattern(info)) {
|
||||
null -> InlayHintsConfigurable.showSettingsDialogForLanguage(file.project, fileLanguage,
|
||||
Predicate { it is ParameterInlayProviderSettingsModel })
|
||||
null -> showInlaySettings(file.project, fileLanguage, Predicate { it is ParameterInlayProviderSettingsModel })
|
||||
else -> ExcludeListDialog(selectedLanguage, pattern).show()
|
||||
}
|
||||
}
|
||||
|
||||
+16
-76
@@ -3,64 +3,38 @@ package com.intellij.codeInsight.hints.settings
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle
|
||||
import com.intellij.codeInsight.hints.InlayHintsProviderExtension
|
||||
import com.intellij.codeInsight.hints.InlayHintsSettings
|
||||
import com.intellij.codeInsight.hints.settings.language.SingleLanguageInlayHintsConfigurable
|
||||
import com.intellij.ide.DataManager
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.extensions.BaseExtensionPointName
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.options.ShowSettingsUtil
|
||||
import com.intellij.openapi.options.ex.Settings
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.messages.MessageBusConnection
|
||||
import java.util.function.Predicate
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JPanel
|
||||
|
||||
@Deprecated("Use com.intellij.codeInsight.hints.settings.InlaySettingsConfigurable")
|
||||
class InlayHintsConfigurable(private val project: Project) : Configurable, Configurable.Composite, Configurable.WithEpDependencies {
|
||||
private val configurables: List<SingleLanguageInlayHintsConfigurable>
|
||||
private val panel: InlayHintsPanel
|
||||
private var connection: MessageBusConnection? = null
|
||||
override fun getConfigurables(): Array<Configurable> = emptyArray()
|
||||
|
||||
init {
|
||||
val allInlayLanguages = InlaySettingsProvider.EP.getExtensions()
|
||||
.flatMap { it.getSupportedLanguages(project) }
|
||||
.toSortedSet(compareBy { it.displayName })
|
||||
configurables = allInlayLanguages.map { SingleLanguageInlayHintsConfigurable(project, it) }
|
||||
panel = InlayHintsPanel(allInlayLanguages)
|
||||
}
|
||||
|
||||
override fun getConfigurables(): Array<Configurable> = configurables.toTypedArray()
|
||||
|
||||
override fun isModified() = panel.isModified()
|
||||
override fun isModified() = false
|
||||
|
||||
override fun getDisplayName(): String {
|
||||
return CodeInsightBundle.message("settings.inlay.hints.panel.name")
|
||||
}
|
||||
|
||||
override fun createComponent(): JComponent {
|
||||
connection = ApplicationManager.getApplication().messageBus.connect(project)
|
||||
connection?.subscribe(InlayHintsSettings.INLAY_SETTINGS_CHANGED, ConfigurationChangeListener(configurables))
|
||||
|
||||
return panel
|
||||
return JPanel()
|
||||
}
|
||||
|
||||
override fun apply() {
|
||||
panel.apply()
|
||||
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
panel.reset()
|
||||
|
||||
}
|
||||
|
||||
override fun disposeUIResources() {
|
||||
connection?.disconnect()
|
||||
}
|
||||
|
||||
fun loadFromSettings() {
|
||||
for (configurable in configurables) {
|
||||
configurable.reset()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getDependencies(): Collection<BaseExtensionPointName<*>> =
|
||||
@@ -72,60 +46,26 @@ class InlayHintsConfigurable(private val project: Project) : Configurable, Confi
|
||||
* Updates settings UI when external change happens (e. g. when some provider is changed).
|
||||
*/
|
||||
@JvmStatic
|
||||
@Deprecated("New UI doesn't need it, just drop call")
|
||||
fun updateInlayHintsUI() {
|
||||
val dataContextFromFocusAsync = DataManager.getInstance().dataContextFromFocusAsync
|
||||
dataContextFromFocusAsync.onSuccess {
|
||||
val settings = Settings.KEY.getData(it) ?: return@onSuccess
|
||||
val configurable = settings.find(InlayHintsConfigurable::class.java) ?: return@onSuccess
|
||||
configurable.loadFromSettings()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Deprecated("Use com.intellij.codeInsight.hints.settings.InlaySettingsConfigurableKt.showInlaySettings",
|
||||
ReplaceWith("showInlaySettings(project, language, null)"))
|
||||
fun showSettingsDialogForLanguage(project: Project, language: Language) {
|
||||
showSettingsDialogForLanguage(project, language, null)
|
||||
showInlaySettings(project, language, null)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Deprecated("Use com.intellij.codeInsight.hints.settings.InlaySettingsConfigurableKt.showInlaySettings",
|
||||
ReplaceWith("showInlaySettings(project, language, selector)"))
|
||||
fun showSettingsDialogForLanguage(project: Project, language: Language, selector: Predicate<InlayProviderSettingsModel>?) {
|
||||
if (showNewSettings(project, language, selector)) {
|
||||
if (showInlaySettings(project, language, selector)) {
|
||||
return
|
||||
}
|
||||
val languages = hashSetOf<Language>()
|
||||
var current: Language? = language
|
||||
while (current != null) {
|
||||
languages.add(current)
|
||||
current = current.baseLanguage
|
||||
}
|
||||
ShowSettingsUtil.getInstance().showSettingsDialog(
|
||||
project,
|
||||
{ it is SingleLanguageInlayHintsConfigurable && it.language in languages },
|
||||
{ configurable ->
|
||||
if (selector == null) return@showSettingsDialog
|
||||
configurable as SingleLanguageInlayHintsConfigurable
|
||||
val models = configurable.getModels()
|
||||
val model = models.find { selector.test(it) }
|
||||
if (model != null) {
|
||||
configurable.setCurrentModel(model)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ConfigurationChangeListener(private val configurables: List<Configurable>) : InlayHintsSettings.SettingsListener {
|
||||
override fun languageStatusChanged() {
|
||||
reset()
|
||||
}
|
||||
|
||||
override fun globalEnabledStatusChanged(newEnabled: Boolean) {
|
||||
reset()
|
||||
}
|
||||
|
||||
private fun reset() {
|
||||
for (configurable in configurables) {
|
||||
configurable.reset()
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
// Copyright 2000-2020 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.codeInsight.hints.settings
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle
|
||||
import com.intellij.codeInsight.hints.InlayHintsSettings
|
||||
import com.intellij.codeInsight.hints.ParameterHintsPassFactory
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.util.ui.JBUI
|
||||
import java.awt.BorderLayout
|
||||
import javax.swing.*
|
||||
import javax.swing.border.EmptyBorder
|
||||
|
||||
class InlayHintsPanel(languages: Iterable<Language>) : JPanel() {
|
||||
private val hintsEnabledGlobally = JCheckBox(CodeInsightBundle.message("inlay.hints.show.hints.for"), true)
|
||||
private val languagePanels = languages.map { LanguagePanel(it) }
|
||||
|
||||
init {
|
||||
layout = BorderLayout()
|
||||
val label = JLabel(CodeInsightBundle.message("inlay.hints.language.list.description"))
|
||||
add(label, BorderLayout.NORTH)
|
||||
add(createListPanel(), BorderLayout.WEST)
|
||||
reset()
|
||||
}
|
||||
|
||||
private fun createListPanel(): JPanel {
|
||||
val panel = JPanel()
|
||||
panel.layout = BoxLayout(panel, BoxLayout.Y_AXIS)
|
||||
panel.border = JBUI.Borders.empty(0, 10, 0, 0)
|
||||
panel.add(Box.createRigidArea(JBUI.size(0, 10)))
|
||||
val toggleGloballyCheckBox = hintsEnabledGlobally
|
||||
toggleGloballyCheckBox.addActionListener {
|
||||
val selected = toggleGloballyCheckBox.isSelected
|
||||
for (languagePanel in languagePanels) {
|
||||
languagePanel.setCheckBoxEnabled(selected)
|
||||
}
|
||||
}
|
||||
panel.add(toggleGloballyCheckBox)
|
||||
for (languagePanel in languagePanels) {
|
||||
languagePanel.alignmentX = 0f
|
||||
languagePanel.border = EmptyBorder(1, 17, 3, 1)
|
||||
panel.add(languagePanel)
|
||||
}
|
||||
return panel
|
||||
}
|
||||
|
||||
fun isModified() : Boolean {
|
||||
val settings = InlayHintsSettings.instance()
|
||||
if (hintsEnabledGlobally.isSelected != settings.hintsEnabledGlobally()) {
|
||||
return true
|
||||
}
|
||||
for ((index, panel) in languagePanels.withIndex()) {
|
||||
val checkboxSelected = languagePanels[index].selected()
|
||||
val inSettingsEnabled = settings.hintsEnabled(panel.language)
|
||||
if (checkboxSelected != inSettingsEnabled) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun apply() {
|
||||
val settings = InlayHintsSettings.instance()
|
||||
settings.setEnabledGlobally(hintsEnabledGlobally.isSelected)
|
||||
for ((index, panel) in languagePanels.withIndex()) {
|
||||
settings.setHintsEnabledForLanguage(panel.language, languagePanels[index].selected())
|
||||
}
|
||||
ParameterHintsPassFactory.forceHintsUpdateOnNextPass()
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
val settings = InlayHintsSettings.instance()
|
||||
hintsEnabledGlobally.isSelected = settings.hintsEnabledGlobally()
|
||||
for ((index, panel) in languagePanels.withIndex()) {
|
||||
val languagePanel = languagePanels[index]
|
||||
languagePanel.select(settings.hintsEnabled(panel.language))
|
||||
languagePanel.setCheckBoxEnabled(settings.hintsEnabledGlobally())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class LanguagePanel(val language: Language) : JPanel() {
|
||||
val checkBox = JCheckBox(language.displayName)
|
||||
|
||||
init {
|
||||
layout = BoxLayout(this, BoxLayout.X_AXIS)
|
||||
add(checkBox)
|
||||
}
|
||||
|
||||
fun selected() :Boolean {
|
||||
return checkBox.isSelected
|
||||
}
|
||||
|
||||
fun select(value: Boolean) {
|
||||
checkBox.isSelected = value
|
||||
}
|
||||
|
||||
fun setCheckBoxEnabled(value: Boolean) {
|
||||
checkBox.isEnabled = value
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -4,9 +4,9 @@ package com.intellij.codeInsight.hints.settings
|
||||
import com.intellij.codeInsight.codeVision.CodeVisionProvider
|
||||
import com.intellij.codeInsight.codeVision.settings.CodeVisionGroupSettingProvider
|
||||
import com.intellij.codeInsight.hints.*
|
||||
import com.intellij.codeInsight.hints.settings.language.SingleLanguageInlayHintsConfigurable
|
||||
import com.intellij.ide.ui.search.SearchableOptionContributor
|
||||
import com.intellij.ide.ui.search.SearchableOptionProcessor
|
||||
import com.intellij.lang.Language
|
||||
|
||||
private class InlayHintsSettingsSearchableContributor : SearchableOptionContributor() {
|
||||
override fun processOptions(processor: SearchableOptionProcessor) {
|
||||
@@ -23,7 +23,7 @@ private class InlayHintsSettingsSearchableContributor : SearchableOptionContribu
|
||||
for (providerInfo in InlayHintsProviderFactory.EP.extensionList.flatMap(InlayHintsProviderFactory::getProvidersInfo)) {
|
||||
val provider = providerInfo.provider
|
||||
val name = provider.name
|
||||
val id = SingleLanguageInlayHintsConfigurable.getId(providerInfo.language)
|
||||
val id = getId(providerInfo.language)
|
||||
addOption(processor, name, id)
|
||||
val providerWithSettings = provider.withSettings(providerInfo.language, InlayHintsSettings.instance())
|
||||
val configurable = providerWithSettings.configurable
|
||||
@@ -36,6 +36,8 @@ private class InlayHintsSettingsSearchableContributor : SearchableOptionContribu
|
||||
InlayParameterHintsExtension.point?.extensions?.flatMap { it.instance.supportedOptions }?.forEach { addOption(processor, it.name, null) }
|
||||
}
|
||||
|
||||
private fun getId(language: Language) = "inlay.hints." + language.id
|
||||
|
||||
private fun addOption(processor: SearchableOptionProcessor, name: String, id: String?) {
|
||||
if (id != null) {
|
||||
processor.addOptions(name, null, null, id, null, false)
|
||||
|
||||
+2
-6
@@ -8,7 +8,6 @@ import com.intellij.openapi.options.ConfigurableProvider
|
||||
import com.intellij.openapi.options.SearchableConfigurable
|
||||
import com.intellij.openapi.options.ShowSettingsUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import java.util.function.Predicate
|
||||
import javax.swing.JComponent
|
||||
|
||||
@@ -55,14 +54,11 @@ class InlaySettingsConfigurable(val project: Project) : Configurable, Searchable
|
||||
|
||||
class InlaySettingsConfigurableProvider(val project: Project): ConfigurableProvider() {
|
||||
override fun createConfigurable(): Configurable {
|
||||
return if (useNewSettings()) InlaySettingsConfigurable(project) else InlayHintsConfigurable(project)
|
||||
return InlaySettingsConfigurable(project)
|
||||
}
|
||||
}
|
||||
|
||||
private fun useNewSettings() = Registry.`is`("new.inlay.settings", true)
|
||||
|
||||
fun showNewSettings(project: Project, language: Language, selector: Predicate<InlayProviderSettingsModel>?): Boolean {
|
||||
if (!useNewSettings()) return false
|
||||
fun showInlaySettings(project: Project, language: Language, selector: Predicate<InlayProviderSettingsModel>?): Boolean {
|
||||
ShowSettingsUtil.getInstance().showSettingsDialog(project, InlaySettingsConfigurable::class.java) {
|
||||
if (selector != null) {
|
||||
it.selectModel(language, selector)
|
||||
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
// Copyright 2000-2020 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.codeInsight.hints.settings.language
|
||||
|
||||
import com.intellij.codeInsight.hints.InlayHintsPassFactory
|
||||
import com.intellij.codeInsight.hints.ParameterHintsPassFactory
|
||||
import com.intellij.codeInsight.hints.settings.InlayProviderSettingsModel
|
||||
import com.intellij.codeInsight.hints.settings.InlaySettingsProvider
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.options.SearchableConfigurable
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
@Deprecated("Not used in new UI")
|
||||
internal class SingleLanguageInlayHintsConfigurable(project: Project, val language: Language) : Configurable, SearchableConfigurable {
|
||||
private val panel by lazy {
|
||||
SingleLanguageInlayHintsSettingsPanel(getInlayProviderSettingsModels(project, language), language, project)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getInlayProviderSettingsModels(project: Project, language: Language) : Array<InlayProviderSettingsModel> {
|
||||
val models = InlaySettingsProvider.EP.getExtensions().flatMap { it.createModels(project, language) }
|
||||
if (models.isEmpty()) {
|
||||
val provider = InlaySettingsProvider.EP.getExtensions().find { language in it.getSupportedLanguages(project) }!!
|
||||
throw IllegalStateException("Inlay settings provider ${provider.javaClass} declared support for language \"${language.id}\" but doesn't provide a model")
|
||||
}
|
||||
return models.toTypedArray()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getId(language: Language) = "inlay.hints." + language.id
|
||||
|
||||
@JvmStatic
|
||||
fun getHelpTopic(language: Language) = "settings.inlayhints.${language.id}"
|
||||
}
|
||||
|
||||
override fun isModified() = panel.isModified()
|
||||
|
||||
override fun getDisplayName() = language.displayName
|
||||
|
||||
override fun createComponent() = panel
|
||||
|
||||
override fun apply() {
|
||||
panel.apply()
|
||||
ParameterHintsPassFactory.forceHintsUpdateOnNextPass()
|
||||
InlayHintsPassFactory.forceHintsUpdateOnNextPass()
|
||||
}
|
||||
|
||||
override fun getId() = getId(language)
|
||||
|
||||
override fun getHelpTopic() = getHelpTopic(language)
|
||||
|
||||
internal fun getModels() = panel.getModels()
|
||||
|
||||
internal fun setCurrentModel(model: InlayProviderSettingsModel) {
|
||||
panel.setCurrentModel(model)
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
panel.reset()
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -2,7 +2,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.codeInsight.codevision
|
||||
|
||||
import com.intellij.codeInsight.hints.settings.InlayHintsConfigurable
|
||||
import com.intellij.codeInsight.hints.settings.showInlaySettings
|
||||
import com.intellij.codeInsight.navigation.actions.GotoDeclarationAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.PsiElement
|
||||
@@ -109,9 +109,9 @@ class InterfaceImplementations(implNum: Int, limitReached: Boolean) :
|
||||
}
|
||||
|
||||
class SettingsHint : KotlinCodeVisionHint(SETTINGS_FORMAT) {
|
||||
override fun onClick(editor: Editor, element: PsiElement, event: MouseEvent?) {
|
||||
val project = element.project
|
||||
logSettingsClicked(project)
|
||||
InlayHintsConfigurable.showSettingsDialogForLanguage(project, element.language)
|
||||
}
|
||||
override fun onClick(editor: Editor, element: PsiElement, event: MouseEvent?) {
|
||||
val project = element.project
|
||||
logSettingsClicked(project)
|
||||
showInlaySettings(project, element.language, null)
|
||||
}
|
||||
}
|
||||
-2
@@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.codeInsight.hints
|
||||
|
||||
import com.intellij.codeInsight.hints.*
|
||||
import com.intellij.codeInsight.hints.presentation.*
|
||||
import com.intellij.codeInsight.hints.settings.InlayHintsConfigurable
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.openapi.editor.Document
|
||||
import com.intellij.openapi.editor.Editor
|
||||
@@ -181,5 +180,4 @@ abstract class KotlinAbstractHintsProvider<T : Any> : InlayHintsProvider<T> {
|
||||
|
||||
internal fun refreshHints() {
|
||||
InlayHintsPassFactory.forceHintsUpdateOnNextPass()
|
||||
InlayHintsConfigurable.updateInlayHintsUI()
|
||||
}
|
||||
+2
-5
@@ -3,7 +3,7 @@
|
||||
package org.jetbrains.kotlin.idea.codeInsight.hints
|
||||
|
||||
import com.intellij.codeInsight.hints.SettingsKey
|
||||
import com.intellij.codeInsight.hints.settings.InlayHintsConfigurable
|
||||
import com.intellij.codeInsight.hints.settings.showInlaySettings
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
@@ -13,9 +13,6 @@ class ShowInlayHintsSettings(private val providerKey: SettingsKey<*>) : AnAction
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val file = e.getData(CommonDataKeys.PSI_FILE) ?: return
|
||||
val fileLanguage = file.language
|
||||
InlayHintsConfigurable.showSettingsDialogForLanguage(
|
||||
file.project,
|
||||
fileLanguage
|
||||
) { it.id == providerKey.id }
|
||||
showInlaySettings(file.project, fileLanguage) { it.id == providerKey.id }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user