Skip to content

Commit e27e6bc

Browse files
authored
Merge pull request #80 from dinbtechit/bug/fix-#77-fix-#79
Fix #77 #79
2 parents ef54bb1 + e4b8378 commit e27e6bc

File tree

8 files changed

+47
-16
lines changed

8 files changed

+47
-16
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# vscode-theme Changelog
44

55
## Unreleased
6+
### Fixed
7+
- #77 - Pycharm Community edition - Inconsistent colors
8+
- #79 - Adding separate color settings for Python imports
69

710
## 1.8.3 - 2023-06-29
811

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pluginGroup = com.github.dinbtechit.vscodetheme
44
pluginName = VSCode Theme
55
# SemVer format -> https://semver.org
6-
pluginVersion = 1.8.3
6+
pluginVersion = 1.8.4
77

88
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
99
pluginSinceBuild = 211
@@ -16,7 +16,7 @@ platformVersion = 2023.1.1
1616
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1717
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
1818
platformPlugins = JavaScript, com.intellij.java, io.flutter:73.1.1, Dart:231.9065, PsiViewer:231-SNAPSHOT, \
19-
Pythonid:231.8770.65, org.jetbrains.kotlin, com.jetbrains.php:231.8770.68, org.jetbrains.plugins.go:231.8770.53, \
19+
Pythonid:231.8770.65, PythonCore:231.8770.65, org.jetbrains.kotlin, com.jetbrains.php:231.8770.68, org.jetbrains.plugins.go:231.8770.53, \
2020
org.rust.lang:0.4.194.5382-231,com.jetbrains.sh
2121

2222
# Gradle Releases -> https://github.com/gradle/gradle/releases

src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/PyAnnotator.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class PyAnnotator : BaseAnnotator() {
3535
"PY.CLASS_REFERENCE",
3636
DefaultLanguageHighlighterColors.CLASS_REFERENCE
3737
)
38+
39+
val IMPORT_REFERENCE_WITH_BG: TextAttributesKey = TextAttributesKey.createTextAttributesKey(
40+
"PY.CLASS_REFERENCE",
41+
DefaultLanguageHighlighterColors.CLASS_REFERENCE
42+
)
3843
}
3944

4045
override fun getKeywordType(element: PsiElement): TextAttributesKey? {
@@ -62,7 +67,7 @@ class PyAnnotator : BaseAnnotator() {
6267
if (element.parent.reference is PyImportReference
6368
|| element.parent.reference?.resolve() is PyImportedModule
6469
|| element.parent.reference?.resolve() is PyFile) {
65-
type = CLASS_REFERENCE_WITH_BG
70+
type = IMPORT_REFERENCE_WITH_BG
6671
}
6772

6873

src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/settings/PyColorSettingsPage.kt

+14-11
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import java.util.*
1111
class PyColorSettingsPage : PythonColorsPage() {
1212
companion object {
1313
private val ATTRIBUTES: Array<AttributesDescriptor?> = arrayOf(
14-
AttributesDescriptor("SecondaryKeywords", PyAnnotator.SECONDARY_KEYWORD),
15-
AttributesDescriptor("SecondaryKeywordsBg", PyAnnotator.SECONDARY_KEYWORD_WITH_BG),
14+
AttributesDescriptor("Secondary keywords", PyAnnotator.SECONDARY_KEYWORD),
15+
AttributesDescriptor("Secondary keywords with Bg", PyAnnotator.SECONDARY_KEYWORD_WITH_BG),
16+
AttributesDescriptor("Import reference with Bg", PyAnnotator.IMPORT_REFERENCE_WITH_BG),
1617
)
1718
val DESCRIPTORS = mutableMapOf<String, TextAttributesKey>()
1819
}
@@ -25,6 +26,7 @@ class PyColorSettingsPage : PythonColorsPage() {
2526
val descriptors: MutableMap<String, TextAttributesKey> = HashMap()
2627
descriptors["secondaryKeyword"] = PyAnnotator.SECONDARY_KEYWORD
2728
descriptors["secondaryKeywordBg"] = PyAnnotator.SECONDARY_KEYWORD_WITH_BG
29+
descriptors["importReference"] = PyAnnotator.IMPORT_REFERENCE_WITH_BG
2830
return descriptors
2931
}
3032

@@ -34,18 +36,19 @@ class PyColorSettingsPage : PythonColorsPage() {
3436

3537
override fun getDemoText(): String {
3638
return """
37-
<secondaryKeyword>from</secondaryKeyword> flask <secondaryKeyword>import</secondaryKeyword> work
38-
<secondaryKeyword>import</secondaryKeyword> string
39+
<secondaryKeyword>from</secondaryKeyword> <importReference>flask</importReference> <secondaryKeyword>import</secondaryKeyword> <importReference>work</importReference>
40+
<secondaryKeyword>from</secondaryKeyword> <importReference>Something</importReference>, <importReference>Something2</importReference> <secondaryKeyword>import</secondaryKeyword> <importReference>work</importReference>
41+
<secondaryKeyword>import</secondaryKeyword> <importReference>string</importReference>
3942
40-
@app.get("/hello/somename")
41-
<secondaryKeywordBg>async</secondaryKeywordBg> def say_bye(name: bool):
42-
<secondaryKeyword>return</secondaryKeyword> {"message": f"bye {name}"}
43+
@<decorator>app</decorator>.<nestedFuncDef>get</nestedFuncDef>("/hello/somename")
44+
<secondaryKeywordBg>async</secondaryKeywordBg> def <nestedFuncDef>say_bye</nestedFuncDef>(<kwarg>name</kwarg>: <classDef>bool</classDef>):
45+
<secondaryKeyword>return</secondaryKeyword> {"message": f"bye {<kwarg>name</kwarg>}"}
4346
4447
45-
@app.get("/hello/{name}")
46-
<secondaryKeywordBg>async</secondaryKeywordBg> def say_hello(name: bool):
47-
<secondaryKeywordBg>await</secondaryKeywordBg> say_bye(name)
48-
<secondaryKeyword>return</secondaryKeyword> {"message": f"Hello {name}"}
48+
@<decorator>app</decorator>.<nestedFuncDef>get</nestedFuncDef>("/hello/{name}")
49+
<secondaryKeywordBg>async</secondaryKeywordBg> def <nestedFuncDef>say_hello</nestedFuncDef>(<kwarg>name</kwarg>: bool):
50+
<secondaryKeywordBg>await</secondaryKeywordBg> <nestedFuncDef>say_bye</nestedFuncDef>(<kwarg>name</kwarg>)
51+
<secondaryKeyword>return</secondaryKeyword> {"message": f"Hello {<kwarg>name</kwarg>}"}
4952
5053
""".trimIndent() + super.getDemoText()
5154
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<idea-plugin>
2+
<extensions defaultExtensionNs="com.intellij">
3+
<annotator language="Python" order="last"
4+
implementationClass="com.github.dinbtechit.vscodetheme.annotators.PyAnnotator"/>
5+
<colorSettingsPage order="last" implementation="com.github.dinbtechit.vscodetheme.annotators.settings.PyColorSettingsPage"/>
6+
</extensions>
7+
</idea-plugin>

src/main/resources/META-INF/plugin.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<depends config-file="lang-config/dinbtechit-javascript.xml" optional="true">JavaScript</depends>
1111
<depends config-file="lang-config/dinbtechit-java.xml" optional="true">com.intellij.java</depends>
1212
<depends config-file="lang-config/dinbtechit-dart.xml" optional="true">Dart</depends>
13-
<depends config-file="lang-config/dinbtechit-python.xml" optional="true">Pythonid</depends>
13+
<depends config-file="lang-config/dinbtechit-python.xml" optional="true">PythonCore</depends>
14+
<depends config-file="lang-config/dinbtechit-python-community.xml" optional="true">Pythonid</depends>
1415
<depends config-file="lang-config/dinbtechit-kotlin.xml" optional="true">org.jetbrains.kotlin</depends>
1516
<depends config-file="lang-config/dinbtechit-csharp.xml" optional="true">com.intellij.modules.rider</depends>
1617
<depends config-file="lang-config/dinbtechit-php.xml" optional="true">com.jetbrains.php</depends>

src/main/resources/themes/vscode_dark.xml

+7-1
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,13 @@
988988
</option>
989989
<option name="PY.DOC_COMMENT">
990990
<value>
991-
<option name="FOREGROUND" value="cd9069"/>
991+
<option name="FOREGROUND" value="4ec9b0"/>
992+
<option name="BACKGROUND" value="1e1e1e"/>
993+
</value>
994+
</option>
995+
<option name="PY.IMPORTS">
996+
<value>
997+
<option name="FOREGROUND" value="47CCB1"/>
992998
</value>
993999
</option>
9941000
<option name="PY.FUNCTION_CALL">

src/main/resources/themes/vscode_dark_brighter.xml

+6
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,12 @@
991991
<option name="FOREGROUND" value="cd9069"/>
992992
</value>
993993
</option>
994+
<option name="PY.IMPORTS">
995+
<value>
996+
<option name="FOREGROUND" value="47CCB1"/>
997+
<option name="BACKGROUND" value="1e1e1e"/>
998+
</value>
999+
</option>
9941000
<option name="PY.FUNCTION_CALL">
9951001
<value>
9961002
<option name="FOREGROUND" value="e6e6aa"/>

0 commit comments

Comments
 (0)