From eafb8d72180ad03f16e5f7c555e670d1d4942f74 Mon Sep 17 00:00:00 2001 From: Dinesh Date: Thu, 6 Jul 2023 11:25:52 -0300 Subject: [PATCH 1/2] Fix #77 #79 [skip ci] --- CHANGELOG.md | 3 +++ gradle.properties | 4 +-- .../vscodetheme/annotators/PyAnnotator.kt | 7 +++++- .../settings/PyColorSettingsPage.kt | 25 +++++++++++-------- .../dinbtechit-python-community.xml | 7 ++++++ src/main/resources/META-INF/plugin.xml | 3 ++- src/main/resources/themes/vscode_dark.xml | 8 +++++- .../resources/themes/vscode_dark_brighter.xml | 6 +++++ 8 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 src/main/resources/META-INF/lang-config/dinbtechit-python-community.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 625d21b..4d33390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ # vscode-theme Changelog ## Unreleased +### Fixed +- #77 - Pycharm Community edition - Inconsistent colors +- #79 - Adding separate color settings for Python imports ## 1.8.3 - 2023-06-29 diff --git a/gradle.properties b/gradle.properties index 94a4709..e7c55d8 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.8.3 +pluginVersion = 1.8.4 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 211 @@ -16,7 +16,7 @@ platformVersion = 2023.1.1 # 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:73.1.1, Dart:231.9065, PsiViewer:231-SNAPSHOT, \ -Pythonid:231.8770.65, org.jetbrains.kotlin, com.jetbrains.php:231.8770.68, org.jetbrains.plugins.go:231.8770.53, \ +Pythonid:231.8770.65, PythonCore:231.8770.65, org.jetbrains.kotlin, com.jetbrains.php:231.8770.68, org.jetbrains.plugins.go:231.8770.53, \ org.rust.lang:0.4.194.5382-231,com.jetbrains.sh # Gradle Releases -> https://github.com/gradle/gradle/releases 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 9a02648..9dc1961 100644 --- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/PyAnnotator.kt +++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/PyAnnotator.kt @@ -35,6 +35,11 @@ class PyAnnotator : BaseAnnotator() { "PY.CLASS_REFERENCE", DefaultLanguageHighlighterColors.CLASS_REFERENCE ) + + val IMPORT_REFERENCE_WITH_BG: TextAttributesKey = TextAttributesKey.createTextAttributesKey( + "PY.CLASS_REFERENCE", + DefaultLanguageHighlighterColors.CLASS_REFERENCE + ) } override fun getKeywordType(element: PsiElement): TextAttributesKey? { @@ -62,7 +67,7 @@ class PyAnnotator : BaseAnnotator() { if (element.parent.reference is PyImportReference || element.parent.reference?.resolve() is PyImportedModule || element.parent.reference?.resolve() is PyFile) { - type = CLASS_REFERENCE_WITH_BG + type = IMPORT_REFERENCE_WITH_BG } diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/settings/PyColorSettingsPage.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/settings/PyColorSettingsPage.kt index 3bb61f0..1c392d9 100644 --- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/settings/PyColorSettingsPage.kt +++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/settings/PyColorSettingsPage.kt @@ -11,8 +11,9 @@ import java.util.* class PyColorSettingsPage : PythonColorsPage() { companion object { private val ATTRIBUTES: Array = arrayOf( - AttributesDescriptor("SecondaryKeywords", PyAnnotator.SECONDARY_KEYWORD), - AttributesDescriptor("SecondaryKeywordsBg", PyAnnotator.SECONDARY_KEYWORD_WITH_BG), + AttributesDescriptor("Secondary keywords", PyAnnotator.SECONDARY_KEYWORD), + AttributesDescriptor("Secondary keywords with Bg", PyAnnotator.SECONDARY_KEYWORD_WITH_BG), + AttributesDescriptor("Import reference with Bg", PyAnnotator.IMPORT_REFERENCE_WITH_BG), ) val DESCRIPTORS = mutableMapOf() } @@ -25,6 +26,7 @@ class PyColorSettingsPage : PythonColorsPage() { val descriptors: MutableMap = HashMap() descriptors["secondaryKeyword"] = PyAnnotator.SECONDARY_KEYWORD descriptors["secondaryKeywordBg"] = PyAnnotator.SECONDARY_KEYWORD_WITH_BG + descriptors["importReference"] = PyAnnotator.IMPORT_REFERENCE_WITH_BG return descriptors } @@ -34,18 +36,19 @@ class PyColorSettingsPage : PythonColorsPage() { override fun getDemoText(): String { return """ - from flask import work - import string + from flask import work + from Something, Something2 import work + import string - @app.get("/hello/somename") - async def say_bye(name: bool): - return {"message": f"bye {name}"} + @app.get("/hello/somename") + async def say_bye(name: bool): + return {"message": f"bye {name}"} - @app.get("/hello/{name}") - async def say_hello(name: bool): - await say_bye(name) - return {"message": f"Hello {name}"} + @app.get("/hello/{name}") + async def say_hello(name: bool): + await say_bye(name) + return {"message": f"Hello {name}"} """.trimIndent() + super.getDemoText() } 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 new file mode 100644 index 0000000..13910d0 --- /dev/null +++ b/src/main/resources/META-INF/lang-config/dinbtechit-python-community.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 9ff74a0..fee2b1c 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -10,7 +10,8 @@ JavaScript com.intellij.java Dart - Pythonid + PythonCore + Pythonid org.jetbrains.kotlin com.intellij.modules.rider com.jetbrains.php diff --git a/src/main/resources/themes/vscode_dark.xml b/src/main/resources/themes/vscode_dark.xml index ca75214..80c6d5c 100644 --- a/src/main/resources/themes/vscode_dark.xml +++ b/src/main/resources/themes/vscode_dark.xml @@ -988,7 +988,13 @@ + +