From 754c1e80dc3a0ff678756004bc6823ee1fdb0a22 Mon Sep 17 00:00:00 2001 From: Dinesh Date: Sat, 20 Jan 2024 22:36:30 -0400 Subject: [PATCH] Chores - Deprecated APIs and dart highlighting fixes. --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- .../vscodetheme/VSCodeThemeManager.kt | 22 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08f7651..66cf454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ # vscode-theme Changelog ## Unreleased +### Fixed: +- Removed internal APIs - So we can release v1.10.8 ### Fixed: - VScode Light Modern — The icon color of RunWidge is too light to see; by @trofoto diff --git a/gradle.properties b/gradle.properties index 5e45dd3..1edadc7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = com.github.dinbtechit.vscodetheme pluginName = VSCode Theme # SemVer format -> https://semver.org -pluginVersion = 1.10.8 +pluginVersion = 1.10.9 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 233 diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt index c3c90b1..339fba6 100644 --- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt +++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt @@ -4,12 +4,8 @@ import com.github.dinbtechit.vscodetheme.settings.VSCodeThemeSettingsStore import com.intellij.ide.plugins.IdeaPluginDescriptor import com.intellij.ide.plugins.PluginManagerCore import com.intellij.ide.ui.LafManager -import com.intellij.ide.ui.LafManagerListener -import com.intellij.ide.ui.ThemeListProvider -import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.extensions.PluginId -import com.intellij.util.ui.JBUI -import com.jetbrains.rd.util.string.printToString +import com.intellij.util.containers.ContainerUtil /*enum class VSCodeTheme(val theme: String) { UNKNOWN("UNKNOWN"), @@ -40,7 +36,7 @@ class VSCodeThemeManager { try { if (getPlugin()?.isEnabled != null) { val vscodeTheme = - LafManager.getInstance().installedThemes.firstOrNull { it.toString().contains(VSCodeTheme.DARK) } + LafManager.getInstance().installedLookAndFeels.firstOrNull { it.toString().contains(VSCodeTheme.DARK) } return vscodeTheme != null } return false @@ -53,11 +49,12 @@ class VSCodeThemeManager { try { if (isVSCodeThemeReady()) { val convertedSelectedVSCodeTheme = convertOldToNewTheme(selectedVSCodeTheme) - val vscodeTheme = - LafManager.getInstance().installedThemes.firstOrNull { it.toString().contains(convertedSelectedVSCodeTheme) } + val vscodeTheme = + LafManager.getInstance().installedLookAndFeels.firstOrNull { it.toString().contains(convertedSelectedVSCodeTheme) } + ContainerUtil.find(LafManager.getInstance().installedLookAndFeels) { it.name === convertedSelectedVSCodeTheme} if (vscodeTheme != null) { - LafManager.getInstance().currentUIThemeLookAndFeel = vscodeTheme + LafManager.getInstance().currentLookAndFeel = vscodeTheme } if (always) { val settings = VSCodeThemeSettingsStore.instance @@ -71,7 +68,7 @@ class VSCodeThemeManager { } fun isVSCodeThemeSelected(): Boolean { - val theme = LafManager.getInstance().currentUIThemeLookAndFeel + val theme = LafManager.getInstance().currentLookAndFeel if (theme != null) { return theme.toString().contains(VSCodeTheme.DARK) && !theme.toString().contains("Modern") } @@ -79,16 +76,17 @@ class VSCodeThemeManager { } fun isVSCodeDarkModernThemeSelected(): Boolean { - val theme = LafManager.getInstance().currentUIThemeLookAndFeel + val theme = LafManager.getInstance().currentLookAndFeel return theme?.toString()?.contains(VSCodeTheme.DARK_MODERN) ?: false } + + private fun convertOldToNewTheme(theme: String): String { return when (theme) { "DARK_MODERN" -> "VSCode Dark Modern" "DARK" -> "VSCode Dark" else -> theme } - } }