diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d6ccdc..028124a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,12 +3,15 @@
# vscode-theme Changelog
## [Unreleased]
+### Changed
+- Default Annotation - Decommissioning Default Annotator due to Issue #38
+- Typescript await keyword inconsistency.
## [1.7.3]
-### Fixed
-- Go - improve syntax highlighting
+### Fixed
+- Go - improve syntax highlighting
-### Changed
+### Changed
- Option to star the github repo
## [1.7.2]
@@ -119,4 +122,4 @@
- Added extensive syntax highlighting for Dart/Flutter.
### Fixed
-- WelcomeScreen color issues and Toolbar border
\ No newline at end of file
+- WelcomeScreen color issues and Toolbar border
diff --git a/gradle.properties b/gradle.properties
index e31feee..de3bd37 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.7.3
+pluginVersion = 1.7.4
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 211
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DefaultAnnotator.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DefaultAnnotator.kt
index 287437c..756a5fe 100644
--- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DefaultAnnotator.kt
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/DefaultAnnotator.kt
@@ -21,6 +21,24 @@ class DefaultAnnotator : BaseAnnotator() {
override fun getKeywordType(element: PsiElement): TextAttributesKey? {
var type: TextAttributesKey? = null
+ val supportLanguages = listOf(
+ "kotlin",
+ "ObjectiveC",
+ "Dart",
+ "go",
+ "JAVA",
+ "JavaScript",
+ "php",
+ "python",
+ "rust",
+ "typescript"
+ )
+
+ try {
+ if (supportLanguages.map { it.lowercase() }.contains(element.language.id.lowercase())) return null
+ } catch(_: Exception) {
+ }
+
when (element.text) {
"new", "return" -> type = SECONDARY_KEYWORD
"if", "else", "switch", "case", "default", "break", "continue", "assert" -> type = SECONDARY_KEYWORD
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 e97ed85..4409f7e 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,18 @@
package com.github.dinbtechit.vscodetheme.annotators
import com.intellij.lang.ecmascript6.psi.ES6FromClause
+import com.intellij.lang.ecmascript6.psi.ES6ImportDeclaration
import com.intellij.lang.ecmascript6.psi.ES6ImportSpecifier
+import com.intellij.lang.ecmascript6.psi.ES6ImportedBinding
+import com.intellij.lang.ecmascript6.types.ES6ImportDeclarationElementType
+import com.intellij.lang.javascript.JSElementType
import com.intellij.lang.javascript.psi.JSLoopStatement
+import com.intellij.lang.javascript.psi.JSReferenceExpression
import com.intellij.lang.javascript.psi.JSStatement
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.psi.PsiElement
+import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.util.ObjectUtils
class JSAnnotator : BaseAnnotator() {
@@ -29,6 +35,10 @@ class JSAnnotator : BaseAnnotator() {
"JS.SECONDARY_KEYWORDS", JS_KEYWORD
)
+ val SECONDARY_KEYWORDS_WITH_BG: TextAttributesKey = TextAttributesKey.createTextAttributesKey(
+ "DEFAULT_SECONDARY_KEYWORD_WITH_BG", JS_KEYWORD
+ )
+
val FROM_KEYWORD: TextAttributesKey = TextAttributesKey.createTextAttributesKey(
"JS.FROM_KEYWORD", JS_KEYWORD
)
@@ -39,7 +49,8 @@ class JSAnnotator : BaseAnnotator() {
var type: TextAttributesKey? = null
when (element.text) {
"package", "export", "import", "require", "module", "return" -> type = SECONDARY_KEYWORDS
- "await", "try", "throw", "catch", "finally", "yield", "break", "continue", "with",
+ "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
@@ -49,7 +60,7 @@ class JSAnnotator : BaseAnnotator() {
}
when (element.parent) {
- is ES6ImportSpecifier -> type = IMPORT_SPECIFIER
+ is ES6ImportSpecifier, is ES6ImportedBinding -> type = IMPORT_SPECIFIER
else -> {}
}
diff --git a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/KotlinAnnotator.kt b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/KotlinAnnotator.kt
index 9d2d471..eaec372 100644
--- a/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/KotlinAnnotator.kt
+++ b/src/main/kotlin/com/github/dinbtechit/vscodetheme/annotators/KotlinAnnotator.kt
@@ -1,12 +1,21 @@
package com.github.dinbtechit.vscodetheme.annotators
+import com.intellij.lang.ParserDefinition
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiTypeElement
+import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.psi.util.elementType
import com.intellij.util.ObjectUtils
+import org.jetbrains.kotlin.idea.editor.wordSelection.KotlinStringLiteralSelectioner
import org.jetbrains.kotlin.lexer.KtKeywordToken
+import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.parsing.KotlinParserDefinition
+import org.jetbrains.kotlin.psi.KtElement
+import org.jetbrains.kotlin.psi.KtLiteralStringTemplateEntry
+import org.jetbrains.kotlin.psi.KtStringTemplateEntry
+import org.jetbrains.uast.kotlin.KotlinStringULiteralExpression
class KotlinAnnotator : BaseAnnotator() {
companion object {
@@ -30,15 +39,16 @@ class KotlinAnnotator : BaseAnnotator() {
override fun getKeywordType(element: PsiElement): TextAttributesKey? {
var type: TextAttributesKey? = null
- if (element.elementType is KtKeywordToken) {
- when (element.text) {
- "return", "as" -> type = SECONDARY_KEYWORD
- "if", "else", "when", "default", "break", "continue" -> type = SECONDARY_KEYWORD
- "try", "finally", "throw" -> type = SECONDARY_KEYWORD
- "catch" -> type = SECONDARY_KEYWORD_BG
- "for", "while", "do" -> type = SECONDARY_KEYWORD
- else -> {}
- }
+
+ if ((element as LeafPsiElement).elementType == KtTokens.REGULAR_STRING_PART) return null
+
+ when (element.text) {
+ "return", "as" -> type = SECONDARY_KEYWORD
+ "if", "else", "when", "default", "break", "continue" -> type = SECONDARY_KEYWORD
+ "try", "finally", "throw" -> type = SECONDARY_KEYWORD
+ "catch" -> type = SECONDARY_KEYWORD_BG
+ "for", "while", "do" -> type = SECONDARY_KEYWORD
+ else -> {}
}
when (element.parent) {
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index b43eb3e..a76df88 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -28,7 +28,8 @@
serviceImplementation="com.github.dinbtechit.vscodetheme.settings.VSCodeThemeSettingsStore"/>
-
+
+
+