diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9d1600d..4602145 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -67,7 +67,7 @@ jobs:
# Check out current repository
- name: Fetch Sources
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
# Validate wrapper
- name: Gradle Wrapper Validation
@@ -75,7 +75,7 @@ jobs:
# Set up Java environment for the next steps
- name: Setup Java
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
@@ -135,11 +135,11 @@ jobs:
# Check out current repository
- name: Fetch Sources
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
@@ -188,18 +188,18 @@ jobs:
# Check out current repository
- name: Fetch Sources
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
# Run Qodana inspections
- name: Qodana - Code Inspection
- uses: JetBrains/qodana-action@v2023.2.1
+ uses: JetBrains/qodana-action@v2023.2.8
with:
cache-default-branch-only: true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 43372b5..0d48e56 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -20,13 +20,13 @@ jobs:
# Check out current repository
- name: Fetch Sources
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
# Set up Java environment for the next steps
- name: Setup Java
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
diff --git a/.github/workflows/run-ui-tests.yml b/.github/workflows/run-ui-tests.yml
index cadd24f..05e483b 100644
--- a/.github/workflows/run-ui-tests.yml
+++ b/.github/workflows/run-ui-tests.yml
@@ -33,11 +33,11 @@ jobs:
# Check out current repository
- name: Fetch Sources
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
diff --git a/.run/Run IDE for UI Tests.run.xml b/.run/Run IDE for UI Tests.run.xml
index 9b028c3..ee99b7e 100644
--- a/.run/Run IDE for UI Tests.run.xml
+++ b/.run/Run IDE for UI Tests.run.xml
@@ -5,18 +5,21 @@
-
+
true
true
false
+ false
\ No newline at end of file
diff --git a/.run/Run Qodana.run.xml b/.run/Run Qodana.run.xml
index 9603583..c92f33c 100644
--- a/.run/Run Qodana.run.xml
+++ b/.run/Run Qodana.run.xml
@@ -9,18 +9,22 @@
-
+
-
+
+
+
+
true
true
false
+ false
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6419b33..08f7651 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@
### Fixed:
- VScode Light Modern — The icon color of RunWidge is too light to see; by @trofoto
- VScode Light Modern — The background color of RecentProject is too dark. by @trofoto
+- Dart Secondary Color Highlighting issues fixed
+- Replaced Deprecated APIs
## 1.10.7 - 2023-10-30
diff --git a/build.gradle.kts b/build.gradle.kts
index 1a91123..f3a7384 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,3 +1,4 @@
+
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
@@ -11,6 +12,7 @@ plugins {
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
+ id("org.jetbrains.grammarkit") version "2021.2.2"
}
group = properties("pluginGroup").get()
@@ -20,6 +22,7 @@ version = properties("pluginVersion").get()
repositories {
mavenCentral()
}
+sourceSets["main"].java.srcDirs("src/main/gen")
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
@@ -28,7 +31,11 @@ dependencies {
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
- jvmToolchain(17)
+ @Suppress("UnstableApiUsage")
+ jvmToolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ vendor = JvmVendorSpec.JETBRAINS
+ }
}
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
@@ -36,7 +43,7 @@ intellij {
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")
-
+ downloadSources = true
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
}
@@ -69,6 +76,21 @@ tasks {
gradleVersion = properties("gradleVersion").get()
}
+/* generateLexer {
+ source.set("src/main/kotlin/com/github/dinbtechit/vscodetheme/languages/dart/grammar/_DartLexer.flex")
+ targetDir.set("src/main/gen/com/github/dinbtechit/vscodetheme/languages/dart/grammar")
+ targetClass.set("_DartLexer")
+ purgeOldFiles.set(true)
+ }
+
+ generateParser {
+ source.set("src/main/kotlin/com/github/dinbtechit/vscodetheme/languages/dart/grammar/dart.bnf")
+ targetRoot.set("src/main/gen")
+ pathToParser.set("/com/github/dinbtechit/vscodetheme/languages/dart/grammar/_DartLexer.java")
+ pathToPsiRoot.set("/com/github/dinbtechit/vscodetheme/languages/dart/psi")
+ purgeOldFiles.set(true)
+ }*/
+
patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
diff --git a/gradle.properties b/gradle.properties
index ea6ee9a..5e45dd3 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,18 +6,23 @@ pluginName = VSCode Theme
pluginVersion = 1.10.8
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
-pluginSinceBuild = 223
+pluginSinceBuild = 233
pluginUntilBuild =
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType = IU
-platformVersion = 2023.2.2
+platformVersion = 2023.3
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
-platformPlugins = JavaScript, com.intellij.java, io.flutter:75.1.4, Dart:232.9559.10, PsiViewer:232.2, \
-Pythonid:232.9921.47, PythonCore:232.9921.47, org.jetbrains.kotlin, com.jetbrains.php:232.9921.47, org.jetbrains.plugins.go:232.9921.28, \
-com.jetbrains.rust:232.9921.62,com.jetbrains.sh
+#platformPlugins = JavaScript, com.intellij.java, io.flutter:75.1.4, Dart:232.9559.10, PsiViewer:232.2, \
+#Pythonid:232.9921.47, PythonCore:232.9921.47, org.jetbrains.kotlin, com.jetbrains.php:232.9921.47, org.jetbrains.plugins.go:232.9921.28, \
+#com.jetbrains.rust:232.9921.62,com.jetbrains.sh
+
+# 2023.3
+platformPlugins = JavaScript, com.intellij.java, io.flutter:77.0.1, Dart:233.11799.172, PsiViewer:233.2, \
+Pythonid:233.11799.300, PythonCore:233.11799.241, org.jetbrains.kotlin, com.jetbrains.php:233.11799.300, org.jetbrains.plugins.go:233.11799.196, \
+com.jetbrains.rust:233.21799.284,com.jetbrains.sh
# 2022.3.3
#platformPlugins = JavaScript, com.intellij.java, io.flutter:75.1.2, Dart:223.8950, PsiViewer:2022.3, \
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 9f5d93e..febb8cd 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,13 +1,13 @@
[versions]
# libraries
-annotations = "24.0.1"
+annotations = "24.1.0"
# plugins
-kotlin = "1.9.10"
+kotlin = "1.9.21"
changelog = "2.2.0"
-gradleIntelliJPlugin = "1.15.0"
+gradleIntelliJPlugin = "1.16.1"
qodana = "0.1.13"
-kover = "0.7.3"
+kover = "0.7.5"
[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 7f93135..d64cd49 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ac72c34..1af9e09 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
index 0adc8e1..1aa94a4 100755
--- a/gradlew
+++ b/gradlew
@@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
diff --git a/qodana.yml b/qodana.yml
index d7c5065..cbf640f 100644
--- a/qodana.yml
+++ b/qodana.yml
@@ -2,6 +2,8 @@
# https://www.jetbrains.com/help/qodana/qodana-yaml.html
version: 1.0
+linter: jetbrains/qodana-jvm-community:latest
+projectJDK: "17"
profile:
name: qodana.recommended
exclude:
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 21749a8..9adc4b3 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,2 +1,6 @@
+plugins {
+ id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
+}
+
rootProject.name = "vscode-theme"
//include("ide-clion")
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt
index f5628d8..c3c90b1 100644
--- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt
@@ -4,7 +4,12 @@ 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
/*enum class VSCodeTheme(val theme: String) {
UNKNOWN("UNKNOWN"),
@@ -35,7 +40,7 @@ class VSCodeThemeManager {
try {
if (getPlugin()?.isEnabled != null) {
val vscodeTheme =
- LafManager.getInstance().installedLookAndFeels.first { it.name == VSCodeTheme.DARK }
+ LafManager.getInstance().installedThemes.firstOrNull { it.toString().contains(VSCodeTheme.DARK) }
return vscodeTheme != null
}
return false
@@ -49,8 +54,11 @@ class VSCodeThemeManager {
if (isVSCodeThemeReady()) {
val convertedSelectedVSCodeTheme = convertOldToNewTheme(selectedVSCodeTheme)
val vscodeTheme =
- LafManager.getInstance().installedLookAndFeels.first { it.name == convertedSelectedVSCodeTheme }
- LafManager.getInstance().currentLookAndFeel = vscodeTheme
+ LafManager.getInstance().installedThemes.firstOrNull { it.toString().contains(convertedSelectedVSCodeTheme) }
+
+ if (vscodeTheme != null) {
+ LafManager.getInstance().currentUIThemeLookAndFeel = vscodeTheme
+ }
if (always) {
val settings = VSCodeThemeSettingsStore.instance
settings.alwaysApply = true
@@ -58,10 +66,23 @@ class VSCodeThemeManager {
}
}
} catch (e: Exception) {
- throw(Error("Unable to select the default theme $selectedVSCodeTheme", e))
+ throw (Error("Unable to select the default theme $selectedVSCodeTheme", e))
}
}
+ fun isVSCodeThemeSelected(): Boolean {
+ val theme = LafManager.getInstance().currentUIThemeLookAndFeel
+ if (theme != null) {
+ return theme.toString().contains(VSCodeTheme.DARK) && !theme.toString().contains("Modern")
+ }
+ return false
+ }
+
+ fun isVSCodeDarkModernThemeSelected(): Boolean {
+ val theme = LafManager.getInstance().currentUIThemeLookAndFeel
+ return theme?.toString()?.contains(VSCodeTheme.DARK_MODERN) ?: false
+ }
+
private fun convertOldToNewTheme(theme: String): String {
return when (theme) {
"DARK_MODERN" -> "VSCode Dark Modern"
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DartAnnotator.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DartAnnotator.kt
index 8ef17c5..28daaa2 100644
--- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DartAnnotator.kt
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DartAnnotator.kt
@@ -2,7 +2,9 @@ package com.github.dinbtechit.vscodetheme.annotators
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.psi.PsiElement
+import com.intellij.psi.util.elementType
import com.intellij.util.ObjectUtils
+import com.jetbrains.lang.dart.DartTokenTypes
import com.jetbrains.lang.dart.highlight.DartSyntaxHighlighterColors
import com.jetbrains.lang.dart.psi.DartStringLiteralExpression
@@ -11,9 +13,8 @@ class DartAnnotator : BaseAnnotator() {
companion object {
val KEYWORD: TextAttributesKey = DartSyntaxHighlighterColors.KEYWORD
val TYPE_KEYWORD: TextAttributesKey = DartSyntaxHighlighterColors.TYPE_PARAMETER
- val SECONDARY_KEYWORD: TextAttributesKey = ObjectUtils.notNull(
- TextAttributesKey.find("DART_SECONDARY_KEYWORD"), KEYWORD
- )
+ val SECONDARY_KEYWORD: TextAttributesKey =
+ TextAttributesKey.createTextAttributesKey("DART_SECONDARY_KEYWORD", KEYWORD)
val SECONDARY_KEYWORD_WITH_BG: TextAttributesKey = ObjectUtils.notNull(
TextAttributesKey.find("DART_SECONDARY_KEYWORD_WITH_BG"), KEYWORD
)
@@ -25,19 +26,26 @@ class DartAnnotator : BaseAnnotator() {
when (element.text) {
"required" -> type = KEYWORD
"Function" -> type = TYPE_KEYWORD
- "new", "return" -> type = SECONDARY_KEYWORD
- "if", "else", "switch", "case", "default", "break", "continue", "assert" -> type = SECONDARY_KEYWORD
- "try", "catch", "finally", "throw", "rethrow" -> type = SECONDARY_KEYWORD
- "for", "while", "do", "in" -> type = SECONDARY_KEYWORD
- "await", "sync", "async", "yield", "on" -> type = SECONDARY_KEYWORD_WITH_BG
"*" -> if (element.prevSibling != null) {
when (element.prevSibling.text) {
"await", "sync", "async", "yield" -> type = SECONDARY_KEYWORD_WITH_BG
}
}
+
else -> {}
}
+ when (element.elementType) {
+ DartTokenTypes.NEW, DartTokenTypes.RETURN, DartTokenTypes.IF, DartTokenTypes.ELSE,
+ DartTokenTypes.IMPORT,
+ DartTokenTypes.SWITCH, DartTokenTypes.CASE, DartTokenTypes.DEFAULT,
+ DartTokenTypes.BREAK, DartTokenTypes.CONTINUE, DartTokenTypes.ASSERT,
+ DartTokenTypes.FOR, DartTokenTypes.WHILE, DartTokenTypes.DO,
+ DartTokenTypes.IN, DartTokenTypes.AWAIT, DartTokenTypes.ASYNC, DartTokenTypes.YIELD, DartTokenTypes.ON,
+ DartTokenTypes.TRY, DartTokenTypes.CATCH, DartTokenTypes.FINALLY, DartTokenTypes.THROW, DartTokenTypes.RETHROW
+ -> type = SECONDARY_KEYWORD
+ }
+
return type
}
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/JSAnnotator.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/JSAnnotator.kt
index 396bf4e..19d5f26 100644
--- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/JSAnnotator.kt
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/JSAnnotator.kt
@@ -1,12 +1,13 @@
package com.github.dinbtechit.vscodetheme.annotators
-import com.intellij.lang.ecmascript6.psi.ES6FromClause
import com.intellij.lang.ecmascript6.psi.ES6ImportSpecifier
import com.intellij.lang.ecmascript6.psi.ES6ImportedBinding
+import com.intellij.lang.javascript.JSTokenTypes
import com.intellij.lang.javascript.psi.JSLoopStatement
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.psi.PsiElement
+import com.intellij.psi.util.elementType
import com.intellij.util.ObjectUtils
class JSAnnotator : BaseAnnotator() {
@@ -42,17 +43,25 @@ class JSAnnotator : BaseAnnotator() {
override fun getKeywordType(element: PsiElement): TextAttributesKey? {
var type: TextAttributesKey? = null
when (element.text) {
- "package", "export", "import", "require", "module", "return" -> type = SECONDARY_KEYWORDS
- "await" -> type = SECONDARY_KEYWORDS_WITH_BG
- "try", "throw", "catch", "finally", "yield", "break", "continue", "with",
- "if", "else", "switch", "case", "default" -> type = SECONDARY_KEYWORDS
- "for", "while", "do" -> if (element.context is JSLoopStatement) type = SECONDARY_KEYWORDS
- "from" -> if (element.parent is ES6FromClause) type = FROM_KEYWORD
"null", "undefined" -> type = JS_NULL
"console" -> type = JS_KEYWORD
else -> {}
}
+ when (element.elementType) {
+ JSTokenTypes.PACKAGE_KEYWORD, JSTokenTypes.EXPORT_KEYWORD, JSTokenTypes.IMPORT_KEYWORD,
+ JSTokenTypes.REQUIRE_KEYWORD, JSTokenTypes.MODULE_KEYWORD, JSTokenTypes.RETURN_KEYWORD,
+ JSTokenTypes.TRY_KEYWORD, JSTokenTypes.THROW_KEYWORD, JSTokenTypes.CATCH_KEYWORD,
+ JSTokenTypes.FINALLY_KEYWORD, JSTokenTypes.YIELD_KEYWORD, JSTokenTypes.BREAK_KEYWORD,
+ JSTokenTypes.IF_KEYWORD, JSTokenTypes.ELSE_KEYWORD, JSTokenTypes.SWITCH_KEYWORD,
+ JSTokenTypes.CASE_KEYWORD, JSTokenTypes.DEFAULT_KEYWORD,
+ JSTokenTypes.CONTINUE_KEYWORD, JSTokenTypes.WITH_KEYWORD,
+ JSTokenTypes.FROM_KEYWORD, JSTokenTypes.AWAIT_KEYWORD -> type = SECONDARY_KEYWORDS
+
+ JSTokenTypes.FOR_KEYWORD, JSTokenTypes.WHILE_KEYWORD,
+ JSTokenTypes.DO_KEYWORD -> if (element.context is JSLoopStatement) type = SECONDARY_KEYWORDS
+ }
+
when (element.parent) {
is ES6ImportSpecifier, is ES6ImportedBinding -> type = IMPORT_SPECIFIER
else -> {}
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/PyAnnotator.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/PyAnnotator.kt
index e3bf00c..5dd3208 100644
--- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/PyAnnotator.kt
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/PyAnnotator.kt
@@ -7,6 +7,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.psi.PsiElement
import com.intellij.psi.util.elementType
import com.intellij.util.ObjectUtils
+import com.jetbrains.python.PyTokenTypes
import com.jetbrains.python.psi.*
import com.jetbrains.python.psi.impl.PyImportedModule
import com.jetbrains.python.psi.impl.references.PyImportReference
@@ -105,6 +106,10 @@ class PyAnnotator : BaseAnnotator() {
else -> {}
}
+ when(element.elementType) {
+ PyTokenTypes.RETURN_KEYWORD -> type = SECONDARY_KEYWORD
+ }
+
return type
}
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/highlightVisitor/PyHighlightVisitor.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/highlightVisitor/PyHighlightVisitor.kt
new file mode 100644
index 0000000..e929aa8
--- /dev/null
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/highlightVisitor/PyHighlightVisitor.kt
@@ -0,0 +1,62 @@
+package com.github.dinbtechit.vscodetheme.highlightVisitor
+
+import com.github.dinbtechit.vscodetheme.annotators.PyAnnotator
+import com.intellij.codeInsight.daemon.impl.HighlightInfo
+import com.intellij.codeInsight.daemon.impl.HighlightInfoType
+import com.intellij.codeInsight.daemon.impl.HighlightVisitor
+import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder
+import com.intellij.lang.ASTNode
+import com.intellij.lang.annotation.HighlightSeverity
+import com.intellij.openapi.editor.colors.TextAttributesKey
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiFile
+import com.intellij.psi.util.elementType
+import com.jetbrains.python.PyTokenTypes
+import com.jetbrains.python.PythonFileType
+
+class PyHighlightVisitor : HighlightVisitor {
+ private var highlightHolder: HighlightInfoHolder? = null
+ override fun suitableForFile(p0: PsiFile): Boolean {
+ return p0.fileType is PythonFileType
+ }
+
+ override fun visit(element: PsiElement) {
+ if (highlightHolder == null) return
+ if(element.elementType == PyTokenTypes.RETURN_KEYWORD) {
+ highlightHolder!!.add(createInfoHighlight(element.node, PyAnnotator.SECONDARY_KEYWORD_WITH_BG))
+ }
+ }
+
+ private fun createInfoHighlight(
+ node: ASTNode,
+ textAttributesKey: TextAttributesKey,
+ ): HighlightInfo? {
+ with(node.textRange) {
+ return HighlightInfo.newHighlightInfo(HighlightInfoType.INFORMATION)
+ .range(this)
+ .textAttributes(textAttributesKey)
+ .severity(HighlightSeverity.INFORMATION)
+ .create()
+ }
+ }
+
+ override fun analyze(
+ psiFile: PsiFile,
+ updateWholeFile: Boolean,
+ holder: HighlightInfoHolder,
+ action: Runnable
+ ): Boolean {
+ highlightHolder = holder
+ try {
+ action.run()
+ } catch (_: Throwable) {
+ } finally {
+ highlightHolder = null
+ }
+ return true
+ }
+
+ override fun clone(): HighlightVisitor {
+ return PyHighlightVisitor()
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/startup/VSCodeStartupNotifyActivity.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/startup/VSCodeStartupNotifyActivity.kt
index 2fb7099..38669a9 100644
--- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/startup/VSCodeStartupNotifyActivity.kt
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/startup/VSCodeStartupNotifyActivity.kt
@@ -10,7 +10,6 @@ import com.github.dinbtechit.vscodetheme.icons.VSCodeIcons
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.notification.Notification
import com.intellij.notification.NotificationGroupManager
import com.intellij.notification.NotificationType
@@ -33,7 +32,6 @@ object DisplayActionType {
class VSCodeStartupNotifyActivity : StartupActivity {
-
private val updateContent: String by lazy {
//language=HTML
"""
@@ -84,7 +82,7 @@ class VSCodeStartupNotifyActivity : StartupActivity {
}
}
// Uncomment for Testing popup
- // showNotificationPopup(project)
+ showNotificationPopup(project)
}
@@ -97,10 +95,6 @@ class VSCodeStartupNotifyActivity : StartupActivity {
}
}
- private fun isVSCodeThemeSelected() = LafManager.getInstance().currentLookAndFeel.name == VSCodeTheme.DARK
- private fun isVSCodeDarkModernThemeSelected() =
- LafManager.getInstance().currentLookAndFeel.name == VSCodeTheme.DARK_MODERN
-
private fun showNotificationPopup(project: Project) {
Util.notification = createNotification(
updateMsg(),
@@ -111,10 +105,12 @@ class VSCodeStartupNotifyActivity : StartupActivity {
}
private fun notificationContent(): String {
- if (!isVSCodeThemeSelected() && !isVSCodeDarkModernThemeSelected()) {
+ if (!VSCodeThemeManager.getInstance().isVSCodeThemeSelected() && !VSCodeThemeManager.getInstance()
+ .isVSCodeDarkModernThemeSelected()
+ ) {
Util.displayActionType = DisplayActionType.SHOW_ALL_THEMES_FOR_DEFAULT
return switchThemeQuestion
- } else if (isVSCodeThemeSelected()) {
+ } else if (VSCodeThemeManager.getInstance().isVSCodeThemeSelected()) {
Util.displayActionType = DisplayActionType.SHOW_NEW_DARK_MODERN_THEME
return tryNewDarkModernThemeQuestion
}
diff --git a/src/main/resources/META-INF/lang-config/dinbtechit-dart.xml b/src/main/resources/META-INF/lang-config/dinbtechit-dart.xml
index ec53df1..8518432 100644
--- a/src/main/resources/META-INF/lang-config/dinbtechit-dart.xml
+++ b/src/main/resources/META-INF/lang-config/dinbtechit-dart.xml
@@ -1,7 +1,8 @@
-
+
diff --git a/src/main/resources/META-INF/lang-config/dinbtechit-javascript.xml b/src/main/resources/META-INF/lang-config/dinbtechit-javascript.xml
index 3d9aa5c..783483d 100644
--- a/src/main/resources/META-INF/lang-config/dinbtechit-javascript.xml
+++ b/src/main/resources/META-INF/lang-config/dinbtechit-javascript.xml
@@ -1,7 +1,7 @@
-
diff --git a/src/main/resources/META-INF/lang-config/dinbtechit-python-community.xml b/src/main/resources/META-INF/lang-config/dinbtechit-python-community.xml
index 13910d0..feeb890 100644
--- a/src/main/resources/META-INF/lang-config/dinbtechit-python-community.xml
+++ b/src/main/resources/META-INF/lang-config/dinbtechit-python-community.xml
@@ -1,7 +1,9 @@
-
+
diff --git a/src/main/resources/META-INF/lang-config/dinbtechit-python.xml b/src/main/resources/META-INF/lang-config/dinbtechit-python.xml
index 13910d0..55dc94f 100644
--- a/src/main/resources/META-INF/lang-config/dinbtechit-python.xml
+++ b/src/main/resources/META-INF/lang-config/dinbtechit-python.xml
@@ -1,7 +1,9 @@
-
-
+
+