Skip to content

Commit

Permalink
extensive highlighting for PHP.
Browse files Browse the repository at this point in the history
  • Loading branch information
dinbtechit committed Jun 12, 2022
1 parent e127572 commit 77022f5
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

## [Unreleased]
### Added
- Added extensive syntax highlighting for Php
- Added extensive syntax highlighting for c#
- Added extensive syntax highlighting for php

### Fixed
- Javascript/Typescript - decorator and local variable color same as VSCode
- Javascript/Typescript - await keyword to be same color as VSCode

## [1.3.0]
### Added
- (Experimental) - Introducing adding Code Editor Theme - VSCode Dark Brighter (5% More brighter than the previous theme).
- (Experimental) - Introducing Code Editor Theme - VSCode Dark Brighter (5% More brighter than the previous theme).
With option to switch back to older VSCode Dark theme
- Added extensive syntax highlighting for Kotlin.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ intuitive. This plugin attempts to make the IDE fairly **close** to VSCode Dark+

### Supported Languages
- Advance Syntax highlighting Support:
- JavaScript, TypeScript, Java, Dart/Flutter, Python, Kotlin
- JavaScript, TypeScript, Java, Dart/Flutter, Python, Kotlin, C#/F#, Php
- Basic Syntax highlighting:
- Php, .Net, C++, Go, Ruby and many more.
- C++, Go, Ruby and many more.

### Supported Platforms
Webstorm, Intellij, CLion, PhpStorm, Rider, Android Studio, GoLang and many more.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.github.dinbtechit.vscodetheme.annotators

import com.intellij.openapi.editor.DefaultLanguageHighlighterColors
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.psi.PsiComment
import com.intellij.psi.PsiElement
import com.intellij.util.ObjectUtils
import com.jetbrains.php.lang.psi.elements.*

class PhpAnnotator : BaseAnnotator() {
companion object {
val DEFAULT_KEYWORD: TextAttributesKey = ObjectUtils.notNull(
TextAttributesKey.find("DEFAULT_KEYWORD"), DefaultLanguageHighlighterColors.KEYWORD
)
val SECONDARY_KEYWORD: TextAttributesKey = TextAttributesKey.createTextAttributesKey(
"DEFAULT_SECONDARY_KEYWORD",
DEFAULT_KEYWORD
)

}

override fun getKeywordType(element: PsiElement): TextAttributesKey? {
var type: TextAttributesKey? = null
if (element is PsiComment) return null
when(element.text) {
"{", "}", "(", ")", ";", ":" -> return null
}
when (element.context) {
is ControlStatement -> type = SECONDARY_KEYWORD
is PhpSwitch,
is Else, is PhpBreak, is Try, is PhpReturn -> type = SECONDARY_KEYWORD
else -> {}
}

return type
}

}
6 changes: 6 additions & 0 deletions src/main/resources/META-INF/lang-config/dinbtechit-php.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<annotator language="PHP" order="last"
implementationClass="com.github.dinbtechit.vscodetheme.annotators.PhpAnnotator"/>
</extensions>
</idea-plugin>
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<depends config-file="lang-config/dinbtechit-python.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>
<!--<depends config-file="lang-config/dinbtechit-typescript.xml" optional="true">JavaScript</depends>-->

<extensions defaultExtensionNs="com.intellij">
Expand Down

0 comments on commit 77022f5

Please sign in to comment.