Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #77 #79 [skip ci] #80

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand Down Expand Up @@ -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
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import java.util.*
class PyColorSettingsPage : PythonColorsPage() {
companion object {
private val ATTRIBUTES: Array<AttributesDescriptor?> = 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<String, TextAttributesKey>()
}
Expand All @@ -25,6 +26,7 @@ class PyColorSettingsPage : PythonColorsPage() {
val descriptors: MutableMap<String, TextAttributesKey> = HashMap()
descriptors["secondaryKeyword"] = PyAnnotator.SECONDARY_KEYWORD
descriptors["secondaryKeywordBg"] = PyAnnotator.SECONDARY_KEYWORD_WITH_BG
descriptors["importReference"] = PyAnnotator.IMPORT_REFERENCE_WITH_BG
return descriptors
}

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

override fun getDemoText(): String {
return """
<secondaryKeyword>from</secondaryKeyword> flask <secondaryKeyword>import</secondaryKeyword> work
<secondaryKeyword>import</secondaryKeyword> string
<secondaryKeyword>from</secondaryKeyword> <importReference>flask</importReference> <secondaryKeyword>import</secondaryKeyword> <importReference>work</importReference>
<secondaryKeyword>from</secondaryKeyword> <importReference>Something</importReference>, <importReference>Something2</importReference> <secondaryKeyword>import</secondaryKeyword> <importReference>work</importReference>
<secondaryKeyword>import</secondaryKeyword> <importReference>string</importReference>

@app.get("/hello/somename")
<secondaryKeywordBg>async</secondaryKeywordBg> def say_bye(name: bool):
<secondaryKeyword>return</secondaryKeyword> {"message": f"bye {name}"}
@<decorator>app</decorator>.<nestedFuncDef>get</nestedFuncDef>("/hello/somename")
<secondaryKeywordBg>async</secondaryKeywordBg> def <nestedFuncDef>say_bye</nestedFuncDef>(<kwarg>name</kwarg>: <classDef>bool</classDef>):
<secondaryKeyword>return</secondaryKeyword> {"message": f"bye {<kwarg>name</kwarg>}"}


@app.get("/hello/{name}")
<secondaryKeywordBg>async</secondaryKeywordBg> def say_hello(name: bool):
<secondaryKeywordBg>await</secondaryKeywordBg> say_bye(name)
<secondaryKeyword>return</secondaryKeyword> {"message": f"Hello {name}"}
@<decorator>app</decorator>.<nestedFuncDef>get</nestedFuncDef>("/hello/{name}")
<secondaryKeywordBg>async</secondaryKeywordBg> def <nestedFuncDef>say_hello</nestedFuncDef>(<kwarg>name</kwarg>: bool):
<secondaryKeywordBg>await</secondaryKeywordBg> <nestedFuncDef>say_bye</nestedFuncDef>(<kwarg>name</kwarg>)
<secondaryKeyword>return</secondaryKeyword> {"message": f"Hello {<kwarg>name</kwarg>}"}

""".trimIndent() + super.getDemoText()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<annotator language="Python" order="last"
implementationClass="com.github.dinbtechit.vscodetheme.annotators.PyAnnotator"/>
<colorSettingsPage order="last" implementation="com.github.dinbtechit.vscodetheme.annotators.settings.PyColorSettingsPage"/>
</extensions>
</idea-plugin>
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<depends config-file="lang-config/dinbtechit-javascript.xml" optional="true">JavaScript</depends>
<depends config-file="lang-config/dinbtechit-java.xml" optional="true">com.intellij.java</depends>
<depends config-file="lang-config/dinbtechit-dart.xml" optional="true">Dart</depends>
<depends config-file="lang-config/dinbtechit-python.xml" optional="true">Pythonid</depends>
<depends config-file="lang-config/dinbtechit-python.xml" optional="true">PythonCore</depends>
<depends config-file="lang-config/dinbtechit-python-community.xml" optional="true">Pythonid</depends>
<depends config-file="lang-config/dinbtechit-kotlin.xml" optional="true">org.jetbrains.kotlin</depends>
<depends config-file="lang-config/dinbtechit-csharp.xml" optional="true">com.intellij.modules.rider</depends>
<depends config-file="lang-config/dinbtechit-php.xml" optional="true">com.jetbrains.php</depends>
Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/themes/vscode_dark.xml
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,13 @@
</option>
<option name="PY.DOC_COMMENT">
<value>
<option name="FOREGROUND" value="cd9069"/>
<option name="FOREGROUND" value="4ec9b0"/>
<option name="BACKGROUND" value="1e1e1e"/>
</value>
</option>
<option name="PY.IMPORTS">
<value>
<option name="FOREGROUND" value="47CCB1"/>
</value>
</option>
<option name="PY.FUNCTION_CALL">
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/themes/vscode_dark_brighter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,12 @@
<option name="FOREGROUND" value="cd9069"/>
</value>
</option>
<option name="PY.IMPORTS">
<value>
<option name="FOREGROUND" value="47CCB1"/>
<option name="BACKGROUND" value="1e1e1e"/>
</value>
</option>
<option name="PY.FUNCTION_CALL">
<value>
<option name="FOREGROUND" value="e6e6aa"/>
Expand Down