2 Commits
41 changed files with 952 additions and 670 deletions
-2
View File
@@ -1,8 +1,6 @@
/.idea/*
!/.idea/dictionaries
!/.idea/runConfigurations
/.gradle/
/.kotlin/
/.intellijPlatform/
/build/
-7
View File
@@ -1,7 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>Rainbowify</w>
</words>
</dictionary>
</component>
+2 -2
View File
@@ -4,9 +4,9 @@ This is a fork of the [🌈Rainbow Brackets](https://github.com/izhangzhihao/int
## Key Changes
- Updates for new IntelliJ Platform versions
- Support for C# (Rider)
- Support for C++
- Support for C++ (Rider, CLion, CLion Nova)
- Support for Settings Sync
- Improved highlighting performance
- Increased default setting for maximum line count from 1K to 100K
- Fixed service initialization warnings reported by 2024.2+
+1 -5
View File
@@ -18,19 +18,15 @@ dependencies {
bundledPlugin("org.jetbrains.kotlin")
bundledPlugin("org.jetbrains.plugins.yaml")
compatiblePlugin("Dart")
compatiblePlugin("PythonCore")
compatiblePlugin("com.intellij.clion")
compatiblePlugin("com.intellij.nativeDebug")
compatiblePlugin("com.jetbrains.php")
compatiblePlugin("com.jetbrains.plugins.jade")
compatiblePlugin("com.jetbrains.sh")
compatiblePlugin("org.intellij.scala")
compatiblePlugin("org.jetbrains.plugins.clion.radler")
compatiblePlugin("org.jetbrains.plugins.go-template")
compatiblePlugin("org.jetbrains.plugins.ruby")
plugin("Dart:507.0.0") // https://plugins.jetbrains.com/plugin/6351-dart/versions/stable
testFramework(TestFrameworkType.Platform)
testFramework(TestFrameworkType.Plugin.Java)
testFramework(TestFrameworkType.Plugin.JavaScript)
@@ -57,7 +57,8 @@ object BracePairs {
true
}
}
?.flatMap { listOf(Pair(it.leftBraceType.toString(), it), Pair(it.rightBraceType.toString(), it)) }
?.map { listOf(Pair(it.leftBraceType.toString(), it), Pair(it.rightBraceType.toString(), it)) }
?.flatten()
?.forEach {
val bracePairs = braceMap[it.first]
if (bracePairs == null) {
@@ -73,7 +74,7 @@ object BracePairs {
.toMap()
}
private fun getBraceTypeSetOf(language: Language): Set<IElementType> = language.bracePairs?.values?.flatten()?.flatMap { listOf(it.leftBraceType, it.rightBraceType) }?.toSet() ?: emptySet()
private fun getBraceTypeSetOf(language: Language): Set<IElementType> = language.bracePairs?.values?.flatten()?.map { listOf(it.leftBraceType, it.rightBraceType) }?.flatten()?.toSet() ?: emptySet()
val braceTypeSet: (Language) -> Set<IElementType> = { language: Language -> getBraceTypeSetOf(language) }.memoize()
@@ -1,7 +1,6 @@
package com.chylex.intellij.coloredbrackets
import com.chylex.intellij.coloredbrackets.settings.RainbowSettings
import com.chylex.intellij.coloredbrackets.util.alphaBlend
import com.chylex.intellij.coloredbrackets.util.create
import com.chylex.intellij.coloredbrackets.util.memoize
import com.intellij.codeInsight.daemon.impl.HighlightInfo
@@ -57,9 +56,6 @@ object RainbowHighlighter {
createRainbowAttributesKeys(KEY_ANGLE_BRACKETS, settings.numberOfColors)
}
private val SCOPE_HIGHLIGHTING_KEY = TextAttributesKey.createTempTextAttributesKey("ColoredBrackets:ScopeHighlighting", TextAttributes.ERASE_MARKER)
private val SCOPE_OUTSIDE_HIGHLIGHTING_KEY = TextAttributesKey.createTempTextAttributesKey("ColoredBrackets:ScopeOutsideHighlighting", TextAttributes.ERASE_MARKER)
private val rainbowElement: HighlightInfoType = HighlightInfoType
.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, DefaultLanguageHighlighterColors.CONSTANT)
@@ -230,23 +226,4 @@ object RainbowHighlighter {
private fun EditorColorsScheme.setInherited(key: TextAttributesKey, inherited: Boolean) {
setAttributes(key, if (inherited) AbstractColorsScheme.INHERITED_ATTRS_MARKER else TextAttributes())
}
fun updateScopeHighlightingAttributes(scheme: EditorColorsScheme, rainbowInfo: RainbowInfo): TextAttributesKey {
val defaultBackground = EditorColorsManager.getInstance().globalScheme.defaultBackground
val background = rainbowInfo.color.alphaBlend(defaultBackground, 0.2f)
val attributes = TextAttributes(null, background, rainbowInfo.color, EffectType.BOXED, Font.PLAIN)
scheme.setAttributes(SCOPE_HIGHLIGHTING_KEY, attributes)
return SCOPE_HIGHLIGHTING_KEY
}
fun updateScopeOutsideHighlightingAttributes(scheme: EditorColorsScheme): TextAttributesKey {
val defaultBackground = scheme.defaultBackground
val background = Color.GRAY.alphaBlend(defaultBackground, 0.05f)
val foreground = Color.GRAY.alphaBlend(defaultBackground, 0.55f)
val attributes = TextAttributes(foreground, background, background, EffectType.BOXED, Font.PLAIN)
scheme.setAttributes(SCOPE_OUTSIDE_HIGHLIGHTING_KEY, attributes)
return SCOPE_OUTSIDE_HIGHLIGHTING_KEY
}
}
@@ -35,7 +35,7 @@ abstract class AbstractScopeHighlightingAction : AnAction() {
val offset = editor.caretModel.offset
val rainbowInfo = psiFile.findRainbowInfoAt(offset) ?: return
val highlightManager = HighlightManager.getInstance(project)
val highlighters = editor.addHighlighter(editor, highlightManager, rainbowInfo)
val highlighters = editor.addHighlighter(highlightManager, rainbowInfo)
editor.highlightingDisposer?.dispose()
if (highlighters.isNotEmpty()) {
@@ -47,7 +47,6 @@ abstract class AbstractScopeHighlightingAction : AnAction() {
}
protected abstract fun Editor.addHighlighter(
editor: Editor,
highlightManager: HighlightManager,
rainbowInfo: RainbowInfo,
): Collection<RangeHighlighter>
@@ -1,33 +1,38 @@
package com.chylex.intellij.coloredbrackets.action
import com.chylex.intellij.coloredbrackets.RainbowHighlighter
import com.chylex.intellij.coloredbrackets.RainbowInfo
import com.chylex.intellij.coloredbrackets.settings.RainbowSettings
import com.chylex.intellij.coloredbrackets.util.alphaBlend
import com.intellij.codeInsight.highlighting.HighlightManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.markup.EffectType
import com.intellij.openapi.editor.markup.RangeHighlighter
import com.intellij.openapi.editor.markup.TextAttributes
import java.awt.Font
import java.util.LinkedList
class ScopeHighlightingAction : AbstractScopeHighlightingAction() {
override fun Editor.addHighlighter(
editor: Editor,
highlightManager: HighlightManager,
rainbowInfo: RainbowInfo,
): Collection<RangeHighlighter> {
val attributesKey = RainbowHighlighter.updateScopeHighlightingAttributes(editor.colorsScheme, rainbowInfo)
val defaultBackground = EditorColorsManager.getInstance().globalScheme.defaultBackground
val background = rainbowInfo.color.alphaBlend(defaultBackground, 0.2f)
val attributes = TextAttributes(null, background, rainbowInfo.color, EffectType.BOXED, Font.PLAIN)
val highlighters = LinkedList<RangeHighlighter>()
highlightManager.addRangeHighlight(
this,
rainbowInfo.startOffset,
rainbowInfo.endOffset,
attributesKey,
false,
RainbowSettings.instance.pressAnyKeyToRemoveTheHighlightingEffects,
attributes, //create("ScopeHighlightingAction", attributes),
false, //hideByTextChange
RainbowSettings.instance.pressAnyKeyToRemoveTheHighlightingEffects, //hideByAnyKey
highlighters
)
return highlighters
}
}
@@ -1,21 +1,28 @@
package com.chylex.intellij.coloredbrackets.action
import com.chylex.intellij.coloredbrackets.RainbowHighlighter
import com.chylex.intellij.coloredbrackets.RainbowInfo
import com.chylex.intellij.coloredbrackets.settings.RainbowSettings
import com.chylex.intellij.coloredbrackets.util.alphaBlend
import com.intellij.codeInsight.highlighting.HighlightManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.markup.EffectType
import com.intellij.openapi.editor.markup.RangeHighlighter
import com.intellij.openapi.editor.markup.TextAttributes
import java.awt.Color
import java.awt.Font
import java.util.LinkedList
class ScopeOutsideHighlightingRestrainAction : AbstractScopeHighlightingAction() {
override fun Editor.addHighlighter(
editor: Editor,
highlightManager: HighlightManager,
rainbowInfo: RainbowInfo,
): Collection<RangeHighlighter> {
val attributesKey = RainbowHighlighter.updateScopeOutsideHighlightingAttributes(editor.colorsScheme)
val defaultBackground = EditorColorsManager.getInstance().globalScheme.defaultBackground
val background = Color.GRAY.alphaBlend(defaultBackground, 0.05f)
val foreground = Color.GRAY.alphaBlend(defaultBackground, 0.55f)
val attributes = TextAttributes(foreground, background, background, EffectType.BOXED, Font.PLAIN)
val highlighters = LinkedList<RangeHighlighter>()
val startOffset = rainbowInfo.startOffset
@@ -26,9 +33,9 @@ class ScopeOutsideHighlightingRestrainAction : AbstractScopeHighlightingAction()
this,
0,
startOffset,
attributesKey,
false,
hideByAnyKey,
attributes, //create("ScopeOutsideHighlightingRestrainAction", attributes),
false, //hideByTextChange
hideByAnyKey, //hideByAnyKey
highlighters
)
}
@@ -40,13 +47,14 @@ class ScopeOutsideHighlightingRestrainAction : AbstractScopeHighlightingAction()
this,
endOffset,
lastOffset,
attributesKey,
false,
hideByAnyKey,
attributes, //create("ScopeOutsideHighlightingRestrainAction", attributes),
false, //hideByTextChange
hideByAnyKey, //hideByAnyKey
highlighters
)
}
return highlighters
}
}
@@ -0,0 +1,123 @@
package com.chylex.intellij.coloredbrackets.annotator
import com.chylex.intellij.coloredbrackets.RainbowHighlighter.NAME_ANGLE_BRACKETS
import com.chylex.intellij.coloredbrackets.RainbowHighlighter.NAME_ROUND_BRACKETS
import com.chylex.intellij.coloredbrackets.RainbowHighlighter.NAME_SQUARE_BRACKETS
import com.chylex.intellij.coloredbrackets.RainbowHighlighter.NAME_SQUIGGLY_BRACKETS
import com.chylex.intellij.coloredbrackets.RainbowHighlighter.getRainbowColorByLevel
import com.chylex.intellij.coloredbrackets.annotator.RainbowUtils.annotateUtil
import com.chylex.intellij.coloredbrackets.annotator.RainbowUtils.settings
import com.chylex.intellij.coloredbrackets.settings.RainbowSettings
import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.lang.annotation.Annotator
import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.impl.source.tree.LeafPsiElement
class RainbowAnnotator : Annotator {
override fun annotate(element: PsiElement, holder: AnnotationHolder) {
val settings = settings
if (settings.isRainbowEnabled && element is LeafPsiElement) {
if (!settings.applyColorsOfRoundForAllBrackets) {
if (settings.isEnableRainbowRoundBrackets) annotateUtil(element, holder, "(", ")", NAME_ROUND_BRACKETS)
if (settings.isEnableRainbowSquareBrackets) annotateUtil(element, holder, "[", "]", NAME_SQUARE_BRACKETS)
if (settings.isEnableRainbowSquigglyBrackets) annotateUtil(element, holder, "{", "}", NAME_SQUIGGLY_BRACKETS)
if (settings.isEnableRainbowAngleBrackets) annotateUtil(element, holder, "<", ">", NAME_ANGLE_BRACKETS)
}
else {
if (settings.isEnableRainbowRoundBrackets) annotateUtil(element, holder, "(", ")", NAME_ROUND_BRACKETS)
if (settings.isEnableRainbowSquareBrackets) annotateUtil(element, holder, "[", "]", NAME_ROUND_BRACKETS)
if (settings.isEnableRainbowSquigglyBrackets) annotateUtil(element, holder, "{", "}", NAME_ROUND_BRACKETS)
if (settings.isEnableRainbowAngleBrackets) annotateUtil(element, holder, "<", ">", NAME_ROUND_BRACKETS)
}
}
}
}
object RainbowUtils {
private val leftBracketsSet = setOf("(", "[", "{", "<")
private val rightBracketsSet = setOf(")", "]", "}", ">")
val settings
get() = RainbowSettings.instance
private tailrec fun iterateChildren(
LEFT: String,
RIGHT: String,
currentNode: PsiElement,
currentLevel: Int,
currentChild: PsiElement,
): Int {
val calculatedLevel = if (currentChild is LeafPsiElement) {
//Using `currentChild.elementType.toString()` if we didn't want add more dependencies.
if (!settings.cycleCountOnAllBrackets) {
when (currentChild.text) {
LEFT -> currentLevel + 1
RIGHT -> currentLevel - 1
else -> currentLevel
}
}
else {
when {
leftBracketsSet.contains(currentChild.text) -> currentLevel + 1
rightBracketsSet.contains(currentChild.text) -> currentLevel - 1
else -> currentLevel
}
}
}
else currentLevel
return if ((currentChild != currentNode) && (currentChild != currentNode.parent.lastChild))
iterateChildren(LEFT, RIGHT, currentNode, calculatedLevel, currentChild.nextSibling)
else
calculatedLevel
}
private tailrec fun iterateParents(
LEFT: String,
RIGHT: String,
currentNode: PsiElement,
currentLevel: Int,
): Int = if (currentNode.parent !is PsiFile) {
val calculatedLevel = iterateChildren(LEFT, RIGHT, currentNode, currentLevel, currentNode.parent.firstChild)
iterateParents(LEFT, RIGHT, currentNode.parent, calculatedLevel)
}
else currentLevel
private fun getBracketLevel(element: LeafPsiElement, LEFT: String, RIGHT: String): Int {
//Using `element.elementType.toString()` if we didn't want add more dependencies.
val startLevel = if (element.text == RIGHT) 0 else -1
return iterateParents(LEFT, RIGHT, element, startLevel)
}
fun annotateUtil(
element: LeafPsiElement, holder: AnnotationHolder,
LEFT: String, RIGHT: String, rainbowName: String,
) {
//Using `element.elementType.toString()` if we didn't want add more dependencies.
val level = when (element.text) {
LEFT, RIGHT -> getBracketLevel(element, LEFT, RIGHT)
else -> -1
}
val scheme = EditorColorsManager.getInstance().globalScheme
if (RainbowSettings.instance.isDoNOTRainbowifyTheFirstLevel) {
if (level >= 1) {
holder.newSilentAnnotation(HighlightSeverity.INFORMATION)
.range(element.psi)
.textAttributes(getRainbowColorByLevel(scheme, rainbowName, level))
.create()
}
}
else {
if (level >= 0) {
holder.newSilentAnnotation(HighlightSeverity.INFORMATION)
.range(element.psi)
.textAttributes(getRainbowColorByLevel(scheme, rainbowName, level))
.create()
}
}
}
}
@@ -134,14 +134,13 @@ private fun matchColor(hueValue: Int, hue: Hue): Color {
hueVal -= 360
}
for (color in Color.entries) {
for (color in Color.values()) {
if (hueVal in color.hueRange.first..color.hueRange.second) {
return color
}
}
// Returning Monochrome if we can't find a value, but this should never happen
Color.monochrome
return Color.monochrome
}
}
}
@@ -11,17 +11,15 @@ import com.intellij.openapi.application.ReadAction
import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.SoftWrap
import com.intellij.openapi.editor.ex.DocumentEx
import com.intellij.openapi.editor.ex.EditorEx
import com.intellij.openapi.editor.impl.EditorImpl
import com.intellij.openapi.editor.impl.view.EditorPainter
import com.intellij.openapi.editor.impl.view.VisualLinesIterator
import com.intellij.openapi.editor.markup.CustomHighlighterRenderer
import com.intellij.openapi.editor.markup.RangeHighlighter
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Condition
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiManager
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.xml.XmlFile
import com.intellij.psi.xml.XmlTag
@@ -38,15 +36,13 @@ import kotlin.math.max
* */
class RainbowIndentGuideRenderer : CustomHighlighterRenderer {
override fun paint(editor: Editor, highlighter: RangeHighlighter, g: Graphics) {
if (editor !is EditorEx) {
return
}
if (editor !is EditorEx) return
val rainbowInfo = getRainbowInfo(editor, highlighter) ?: return
val startOffset = highlighter.startOffset
val doc = highlighter.document
if (startOffset >= doc.textLength) {
return
}
if (startOffset >= doc.textLength) return
val endOffset = highlighter.endOffset
@@ -64,21 +60,15 @@ class RainbowIndentGuideRenderer : CustomHighlighterRenderer {
val startPosition = editor.offsetToVisualPosition(off)
val indentColumn = startPosition.column
if (indentColumn <= 0) {
return
}
if (indentColumn <= 0) return
val foldingModel = editor.foldingModel
if (foldingModel.isOffsetCollapsed(off)) {
return
}
if (foldingModel.isOffsetCollapsed(off)) return
val headerRegion = foldingModel.getCollapsedRegionAtOffset(doc.getLineEndOffset(doc.getLineNumber(off)))
val tailRegion = foldingModel.getCollapsedRegionAtOffset(doc.getLineStartOffset(doc.getLineNumber(endOffset)))
if (tailRegion != null && tailRegion === headerRegion) {
return
}
if (tailRegion != null && tailRegion === headerRegion) return
val guide = editor.indentsModel.caretIndentGuide
val selected = if (guide != null) {
@@ -88,7 +78,7 @@ class RainbowIndentGuideRenderer : CustomHighlighterRenderer {
}
else false
val lineHeight = editor.lineHeight
val lineHeight = editor.getLineHeight()
val start = editor.visualPositionToXY(startPosition)
start.y += lineHeight
val endPosition = editor.offsetToVisualPosition(endOffset)
@@ -105,11 +95,7 @@ class RainbowIndentGuideRenderer : CustomHighlighterRenderer {
}
maxY = StrictMath.min(maxY, clip.y + clip.height)
}
if (start.y >= maxY) {
return
}
val rainbowInfo = getRainbowInfo(editor, highlighter) ?: return
if (start.y >= maxY) return
val targetX = max(0, start.x + EditorPainter.getIndentGuideShift(editor)).toDouble()
g.color = if (selected) {
rainbowInfo.color
@@ -177,35 +163,33 @@ class RainbowIndentGuideRenderer : CustomHighlighterRenderer {
}
private fun getRainbowInfo(editor: EditorEx, highlighter: RangeHighlighter): RainbowInfo? {
val project = editor.project ?: return null
val virtualFile = editor.virtualFile?.takeIf { it.isValid } ?: return null
val document = editor.document
val project = editor.project ?: return null
return ReadAction.computeBlocking<RainbowInfo?, Throwable> {
getRainbowInfoInReadAction(project, document, highlighter)
return ReadAction.compute<RainbowInfo, Throwable> {
val psiFile = PsiManager.getInstance(project).findFile(virtualFile) ?: return@compute null
var element = try {
psiFile.findElementAt(highlighter.endOffset)?.parent ?: return@compute null
} catch (_: Throwable) {
return@compute null
}
var rainbowInfo = RainbowInfo.RAINBOW_INFO_KEY[element]
if (rainbowInfo == null && psiFile is XmlFile && element !is XmlTag) {
element = PsiTreeUtil.findFirstParent(element, true, XML_TAG_PARENT_CONDITION) ?: return@compute null
rainbowInfo = RainbowInfo.RAINBOW_INFO_KEY[element] ?: return@compute null
}
if (!element.isValid || !checkBoundary(document, element, highlighter)) {
null
}
else {
rainbowInfo
}
}
}
private fun getRainbowInfoInReadAction(project: Project, document: DocumentEx, highlighter: RangeHighlighter): RainbowInfo? {
val psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document) ?: return null
var element = try {
psiFile.findElementAt(highlighter.endOffset)?.parent ?: return null
} catch (_: Throwable) {
return null
}
var rainbowInfo = RainbowInfo.RAINBOW_INFO_KEY[element]
if (rainbowInfo == null && psiFile is XmlFile && element !is XmlTag) {
element = PsiTreeUtil.findFirstParent(element, true, XML_TAG_PARENT_CONDITION) ?: return null
rainbowInfo = RainbowInfo.RAINBOW_INFO_KEY[element] ?: return null
}
if (!element.isValid || !checkBoundary(document, element, highlighter)) {
return null
}
return rainbowInfo
}
/***
* introduced from https://github.com/izhangzhihao/intellij-rainbow-brackets/commit/d9d40e6910e9c15fbdcba12280df18019ea170b5
*/
@@ -285,5 +269,6 @@ class RainbowIndentGuideRenderer : CustomHighlighterRenderer {
private fun XmlTag.getEndTagStartLineNumber(document: Document): Int? =
lastChild?.findPrevSibling(XML_END_TAG_START_CONDITION)?.let { document.lineNumber(it.startOffset) }
}
}
@@ -46,9 +46,7 @@ class RainbowIndentsPass internal constructor(
override fun doCollectInformation(progress: ProgressIndicator) {
val stamp = myEditor.getUserData(LAST_TIME_INDENTS_BUILT)
if (stamp != null && stamp == nowStamp()) {
return
}
if (stamp != null && stamp.toLong() == nowStamp()) return
myDescriptors = buildDescriptors()
@@ -74,9 +72,7 @@ class RainbowIndentsPass internal constructor(
val stamp = myEditor.getUserData(LAST_TIME_INDENTS_BUILT)
val nowStamp = nowStamp()
if (stamp == nowStamp) {
return
}
if (stamp == nowStamp) return
myEditor.putUserData(LAST_TIME_INDENTS_BUILT, nowStamp)
@@ -146,9 +142,7 @@ class RainbowIndentsPass internal constructor(
}
private fun buildDescriptors(): List<IndentGuideDescriptor> {
if (!isRainbowIndentGuidesShown(this.myProject)) {
return emptyList()
}
if (!isRainbowIndentGuidesShown(this.myProject)) return emptyList()
val calculator = IndentsCalculator()
calculator.calculate()
@@ -17,7 +17,7 @@ class RainbowConfigurable : SearchableConfigurable {
}
override fun isModified(): Boolean {
return settingsForm?.isModified ?: false
return settingsForm?.isModified ?: return false
}
@Throws(ConfigurationException::class)
@@ -49,7 +49,7 @@ class RainbowConfigurable : SearchableConfigurable {
settings.rainbowifyPythonKeywords = settingsForm?.rainbowifyPythonKeywords() ?: false
ProjectManager.getInstanceIfCreated()?.openProjects?.forEach {
DaemonCodeAnalyzer.getInstance(it).restart(this)
DaemonCodeAnalyzer.getInstance(it).restart()
}
}
@@ -39,7 +39,7 @@ class RainbowOptionsPanel(
private lateinit var colorLabel4: JLabel
private lateinit var colorLabel5: JLabel
private val colorLabels = arrayOf(colorLabel1, colorLabel2, colorLabel3, colorLabel4, colorLabel5)
private val colorLabels: Array<JLabel>
private lateinit var color1: ColorPanel
private lateinit var color2: ColorPanel
@@ -47,7 +47,7 @@ class RainbowOptionsPanel(
private lateinit var color4: ColorPanel
private lateinit var color5: ColorPanel
private val colors = arrayOf(color1, color2, color3, color4, color5)
private val colors: Array<ColorPanel>
private lateinit var gradientLabel: JLabel
@@ -56,6 +56,9 @@ class RainbowOptionsPanel(
EventDispatcher.create(ColorAndFontSettingsListener::class.java)
init {
colors = arrayOf(color1, color2, color3, color4, color5)
colorLabels = arrayOf(colorLabel1, colorLabel2, colorLabel3, colorLabel4, colorLabel5)
val actionListener = ActionListener {
eventDispatcher.multicaster.settingsChanged()
options.stateChanged()
@@ -67,9 +70,7 @@ class RainbowOptionsPanel(
options.addListener(object : ColorAndFontSettingsListener.Abstract() {
override fun settingsChanged() {
if (!schemesProvider.areSchemesLoaded()) {
return
}
if (!schemesProvider.areSchemesLoaded()) return
if (optionsTree.selectedValue != null) {
// update options after global state change
processListValueChanged()
@@ -235,9 +236,7 @@ class RainbowOptionsPanel(
}
val pathInChild = findOption(childObject, matcher)
if (pathInChild != null) {
return pathInChild
}
if (pathInChild != null) return pathInChild
}
return null
+5 -19
View File
@@ -8,26 +8,16 @@
<br><br>
<b>Key Changes</b>
<ul>
<li>Updates for new IntelliJ Platform versions</li>
<li>Support for C# (Rider)</li>
<li>Support for C++</li>
<li>Support for C++ (Rider, CLion, CLion Nova)</li>
<li>Support for Settings Sync</li>
<li>Improved highlighting performance</li>
<li>Increased default setting for maximum line count from 1K to 100K</li>
<li>Fixed service initialization warnings reported by 2024.2+</li>
</ul>
]]></description>
<change-notes><![CDATA[
<b>Version 1.5.0</b>
<ul>
<li>Updated to IntelliJ Platform 2026.2.</li>
<li>Added support for C++ plugin for IntelliJ IDEA.</li>
</ul>
<b>Version 1.4.0</b>
<ul>
<li>Updated to IntelliJ Platform 2025.3.</li>
<li>Removed support for the Haskell plugin, since it is no longer available.</li>
</ul>
<b>Version 1.3.0</b>
<ul>
<li>Fixed assertion error caused by missing read lock in indent guide renderer.</li>
@@ -48,13 +38,13 @@
<ul>
<li>Restored support for CLion and Rider.</li>
<li>Added support for Settings Sync.</li>
<li>Fixed service initialization warnings reported by IntelliJ Platform 2024.2.</li>
<li>Fixed service initialization warnings reported by IJ 2024.2.</li>
</ul>
]]></change-notes>
<depends>com.intellij.modules.lang</depends>
<depends optional="true" config-file="plugin-clion-classic.xml">com.intellij.cidr.lang</depends>
<depends optional="true" config-file="plugin-cpp.xml">org.jetbrains.plugins.clion.radler</depends>
<depends optional="true" config-file="plugin-clion-nova.xml">org.jetbrains.plugins.clion.radler</depends>
<depends optional="true" config-file="plugin-clion.xml">com.intellij.modules.clion</depends>
<depends optional="true" config-file="plugin-dart.xml">Dart</depends>
<depends optional="true" config-file="plugin-go-template.xml">org.jetbrains.plugins.go-template</depends>
<depends optional="true" config-file="plugin-groovy.xml">org.intellij.groovy</depends>
@@ -88,10 +78,6 @@
<editorNotificationProvider implementation="com.chylex.intellij.coloredbrackets.RainbowifyBanner" />
</extensions>
<extensions defaultExtensionNs="org.jetbrains.kotlin">
<supportsKotlinPluginMode supportsK2="true" />
</extensions>
<applicationListeners>
<listener class="com.chylex.intellij.coloredbrackets.listener.RainbowColorsSchemeListener" topic="com.intellij.openapi.editor.colors.EditorColorsListener" />
</applicationListeners>
@@ -22,29 +22,32 @@ void main() {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
angleLevel(0),
angleLevel(0),
squareLevel(0),
squareLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(0)
doHighlighting
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
angleLevel(0),
angleLevel(0),
squareLevel(0),
squareLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(0)
)
)
)
}
}
@@ -22,36 +22,39 @@ Map<String, Map<String, String>> convertObjectsToMapProperties(Map<String, Objec
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(0),
roundLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
angleLevel(0),
angleLevel(0),
squareLevel(0),
squareLevel(0),
squigglyLevel(1),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(0),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(0),
roundLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
angleLevel(0),
angleLevel(0),
squareLevel(0),
squareLevel(0),
squigglyLevel(1),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(0),
squigglyLevel(0)
)
)
)
}
}
@@ -1,7 +1,7 @@
package com.chylex.intellij.coloredbrackets
import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.lang.javascript.JSXFileType
import com.intellij.lang.ecmascript6.JSXHarmonyFileType
import com.intellij.lang.javascript.JavaScriptFileType
import com.intellij.lang.javascript.TypeScriptFileType
import com.intellij.openapi.extensions.PluginId
@@ -13,7 +13,7 @@ import org.intellij.lang.annotations.Language
class RainbowJavaScriptTest : LightJavaCodeInsightFixtureTestCase() {
fun testJavaScriptPluginEnabled() {
assertTrue(PluginManagerCore.isLoaded(PluginId("JavaScript")))
assertTrue(PluginManagerCore.getPlugin(PluginId.getId("JavaScript"))?.isEnabled!!)
}
fun testIssue11() {
@@ -24,18 +24,21 @@ const _ = require('lodash') || false
const moment = require('moment')
""".trimIndent()
myFixture.configureByText(JavaScriptFileType, code)
myFixture.configureByText(JavaScriptFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0)
)
)
)
}
fun testIssue12() {
@@ -44,36 +47,42 @@ const moment = require('moment')
console.log(a > b)
console.log(a == b)
""".trimIndent()
myFixture.configureByText(JavaScriptFileType, code)
myFixture.configureByText(JavaScriptFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0)
)
)
)
}
fun testIssue21() {
@Language("JavaScript") val code = $$"open (${f})\nopen (${f} )"
@Language("JavaScript") val code = "open (\$" + "{f})\n" + "open (\$" + "{f} )"
myFixture.configureByText(JavaScriptFileType, code)
myFixture.configureByText(JavaScriptFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0)
)
)
)
}
fun testIssue23() {
@@ -93,30 +102,33 @@ if ((a.field_detail && a.is) ||
""".trimIndent()
myFixture.configureByText(JavaScriptFileType, code)
myFixture.configureByText(JavaScriptFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(0)
)
)
)
}
fun testIssue38() {
@@ -124,53 +136,61 @@ if ((a.field_detail && a.is) ||
const element = ( <div> <h1>Hello, world!</h1> </div> );
""".trimIndent()
myFixture.configureByText(JSXFileType, code)
myFixture.configureByText(JSXHarmonyFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(0),
angleLevel(0),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.filterNot { it == null }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(0),
angleLevel(0),
roundLevel(0)
)
)
)
}
fun testIssue39() {
fun `for somehow, it just don't work "testIssue39"`() {
@Language("JavaScript") val code = """
const html = '<div><div><div>Hello</div></div></div>'
""".trimIndent()
myFixture.configureByText(JavaScriptFileType, code)
myFixture.configureByText(JavaScriptFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(1),
angleLevel(1),
angleLevel(0),
angleLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.filterNot { it == null }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(1),
angleLevel(1),
angleLevel(0),
angleLevel(0)
)
)
)
}
fun testIssue31() {
@@ -181,39 +201,47 @@ const element = ( <div> <h1>Hello, world!</h1> </div> );
const s = `<ololo>`
""".trimIndent()
myFixture.configureByText(TypeScriptFileType, code)
myFixture.configureByText(TypeScriptFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(0),
squareLevel(0),
squareLevel(0),
angleLevel(0),
angleLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.filterNot { it == null }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(0),
squareLevel(0),
squareLevel(0)
//, angleLevel(0)
//, angleLevel(0)
)
)
)
}
fun testIssue427() {
@Language("TypeScript") val code = """let example: Array<Map<string,string>>;""".trimIndent()
myFixture.configureByText(TypeScriptFileType, code)
myFixture.configureByText(TypeScriptFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.filterNot { it == null }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(0)
)
)
)
}
}
@@ -35,26 +35,29 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(2),
roundLevel(2),
roundLevel(1),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(2),
roundLevel(2),
roundLevel(1),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
fun testDisableRainbowForJava() {
@@ -72,9 +75,12 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf()
)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf()
)
}
fun testDisableRainbowAngleBracketsForJava() {
@@ -92,24 +98,27 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
squigglyLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(2),
roundLevel(2),
roundLevel(1),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
squigglyLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(2),
roundLevel(2),
roundLevel(1),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
fun testDisableRainbowRoundBracketsForJava() {
@@ -127,16 +136,19 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
fun testDisableRainbowSquigglyBracketsForJava() {
@@ -154,22 +166,25 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(2),
roundLevel(2),
roundLevel(1),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(2),
roundLevel(2),
roundLevel(1),
roundLevel(0)
)
)
)
}
fun testDoNOTRainbowifyBracketsWithoutContentForJava() {
@@ -187,22 +202,25 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
fun testDoNOTRainbowifyBracketsWhenJavaInBlacklist() {
@@ -221,7 +239,11 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().size.shouldBe(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.size
.shouldBe(0)
}
fun testIssue391() {
@@ -240,28 +262,31 @@ public class Test {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),//{
roundLevel(1),//(
roundLevel(1),//)
roundLevel(1),//{
roundLevel(2),
roundLevel(2),
roundLevel(2),
roundLevel(3),
roundLevel(4),
roundLevel(4),
roundLevel(3),
roundLevel(2),
roundLevel(1),//}
roundLevel(0)//}
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),//{
roundLevel(1),//(
roundLevel(1),//)
roundLevel(1),//{
roundLevel(2),
roundLevel(2),
roundLevel(2),
roundLevel(3),
roundLevel(4),
roundLevel(4),
roundLevel(3),
roundLevel(2),
roundLevel(1),//}
roundLevel(0)//}
)
)
)
}
}
@@ -20,44 +20,47 @@ fun <T> filter(l: List<T>, f: (T) -> Boolean): MutableList<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
roundLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0),
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0),
squigglyLevel(2),
squigglyLevel(2),
squigglyLevel(1),
squigglyLevel(0)
roundLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0),
angleLevel(0),
angleLevel(0),
squigglyLevel(0),
angleLevel(0),
angleLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0),
squigglyLevel(2),
squigglyLevel(2),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
fun testRainbowArrowForKotlin() {
@@ -65,7 +68,7 @@ fun <T> filter(l: List<T>, f: (T) -> Boolean): MutableList<T> {
"""
val a: (Int) -> Unit = { aa ->
val b: (Int) -> Unit = { bb ->
val c: (Int) -> Unit = { cc ->
val c: (Int) -> Unit = { cc ->
val d: (Int) -> Unit = { dd ->
}
}
@@ -76,33 +79,81 @@ val a: (Int) -> Unit = { aa ->
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
squigglyLevel(2),
roundLevel(0),
roundLevel(0),
squigglyLevel(3),
squigglyLevel(3),
squigglyLevel(2),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting
.filter { brackets.contains(it.text.toChar()) || it.text.contains("->") }
.filter { it?.forcedTextAttributesKey?.defaultAttributes != null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
squigglyLevel(2),
squigglyLevel(2),
roundLevel(0),
roundLevel(0),
squigglyLevel(3),
squigglyLevel(3),
squigglyLevel(3),
squigglyLevel(2),
squigglyLevel(1),
squigglyLevel(0)
)
)
}
fun `ForSomeHowTheTestNotPassed "testRainbowLabelForKotlin"`() {
@Language("kotlin") val code =
"""
class AA {
fun aa() {
arrayOf(1, 2, 3).forEach {
it.let dd@{
if (it > 0) a@{
return@dd
}
}
return@forEach
}
}
}
""".trimIndent()
myFixture.configureByText(KotlinFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting
.filter { it.forcedTextAttributes != null && it.text.contains("@") }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
squigglyLevel(3),
squigglyLevel(4),
squigglyLevel(3),
squigglyLevel(2)
)
)
)
}
fun testKotlinFunctionLiteralBracesAndArrow() {
@@ -120,15 +171,20 @@ fun t() {
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting
.filter { brackets.contains(it.text.toChar()) }
.filter { it?.forcedTextAttributesKey?.defaultAttributes != null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
//squigglyLevel(1),
//squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
}
@@ -1,5 +1,6 @@
package com.chylex.intellij.coloredbrackets
import com.intellij.codeInsight.daemon.impl.HighlightInfoType
import com.intellij.psi.PsiDocumentManager
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import com.jetbrains.php.lang.PhpFileType
@@ -27,26 +28,29 @@ function padZero(string data): string
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
squigglyLevel(1),
roundLevel(2),
roundLevel(2),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) && it.severity != HighlightInfoType.INJECTED_FRAGMENT_SEVERITY }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(1),
roundLevel(1),
squigglyLevel(1),
roundLevel(2),
roundLevel(2),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
}
@@ -10,7 +10,7 @@ import org.jetbrains.plugins.ruby.ruby.lang.RubyFileType
class RainbowRubyTest : LightJavaCodeInsightFixtureTestCase() {
fun testRubyPluginEnabled() {
assertTrue(PluginManagerCore.isLoaded(PluginId("org.jetbrains.plugins.ruby")))
assertTrue(PluginManagerCore.getPlugin(PluginId.getId("org.jetbrains.plugins.ruby"))?.isEnabled!!)
}
fun testRainbowForIssue53Part0() {
@@ -24,14 +24,17 @@ end
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(1),
roundLevel(1),
roundLevel(0)
)
)
)
}
fun testRainbowForIssue53Part1() {
@@ -43,12 +46,15 @@ foobar(p1: "", p2: false, p3: 1)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0)
)
)
)
}
fun testRainbowForIssue53Part2() {
@@ -65,20 +71,25 @@ end
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(0)
doHighlighting
.filter { brackets.contains(it.text.toChar()) }
.filterNot { it?.forcedTextAttributesKey?.defaultAttributes == null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(1),
squigglyLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(0)
)
)
)
}
fun testRainbowForIssue53Part3() {
@@ -98,14 +109,19 @@ end
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
squareLevel(0),
squareLevel(0),
squareLevel(0),
squareLevel(0)
doHighlighting
.filter { brackets.contains(it.text.toChar()) }
.filterNot { it?.forcedTextAttributesKey?.defaultAttributes == null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
squareLevel(0),
squareLevel(0),
squareLevel(0),
squareLevel(0)
)
)
)
}
fun testRainbowForIssue53Part4() {
@@ -119,15 +135,20 @@ end
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
squareLevel(0),
squareLevel(1),
squareLevel(2),
squareLevel(2),
squareLevel(1),
squareLevel(0)
doHighlighting
.filter { brackets.contains(it.text.toChar()) }
.filterNot { it?.forcedTextAttributesKey?.defaultAttributes == null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
squareLevel(0),
squareLevel(1),
squareLevel(2),
squareLevel(2),
squareLevel(1),
squareLevel(0)
)
)
)
}
}
@@ -6,9 +6,7 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import org.intellij.lang.annotations.Language
import org.jetbrains.plugins.scala.ScalaFileType
import org.junit.Ignore
@Ignore("IDEA has broken modularization")
class RainbowScalaTest : LightJavaCodeInsightFixtureTestCase() {
override fun tearDown() {
@@ -38,24 +36,28 @@ import scala.annotation.tailrec
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
squareLevel(0),
squareLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
squareLevel(0),
squareLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.filter { it?.forcedTextAttributesKey != null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
squareLevel(0),
squareLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
squareLevel(0),
squareLevel(0),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
fun testDisableRainbowSquareBracketsForScala() {
@@ -76,19 +78,23 @@ import scala.annotation.tailrec
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
doHighlighting.filter { brackets.contains(it.text.toChar()) }
.filter { it?.forcedTextAttributesKey != null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
roundLevel(0),
roundLevel(0),
squigglyLevel(0),
squigglyLevel(1),
roundLevel(0),
roundLevel(0),
squigglyLevel(1),
squigglyLevel(0)
)
)
)
}
}
@@ -8,6 +8,81 @@ import io.kotest.matchers.shouldBe
import org.intellij.lang.annotations.Language
class RainbowXMLTest : LightJavaCodeInsightFixtureTestCase() {
fun `disabled for non-determinist results of testRainbowTagNameForXML`() {
@Language("XML") val code =
"""
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE note SYSTEM>
<idea-plugin>
<name>Rainbow Brackets</name>
<description>
<p>Supported languages:</p>
<p>Java, Scala, Clojure, Kotlin, Python, Haskell, Agda, Rust, JavaScript, TypeScript, Erlang, Go, Groovy, Ruby, Elixir, ObjectiveC, PHP, C#, HTML, XML, SQL, Apex language ...</p>
<br/>
</description>
</idea-plugin>
""".trimIndent()
val rainbowSettings = RainbowSettings.instance
rainbowSettings.rainbowifyTagNameInXML = true
myFixture.configureByText(XmlFileType.INSTANCE, code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),//idea-plugin
angleLevel(0),
angleLevel(1),
angleLevel(1),//name
angleLevel(1),
angleLevel(1),
angleLevel(1),//name
angleLevel(1),
angleLevel(1),
angleLevel(1),//description
angleLevel(1),
angleLevel(2),
angleLevel(2),//p
angleLevel(2),
angleLevel(2),
angleLevel(2),//p
angleLevel(2),
angleLevel(2),
angleLevel(2),//p
angleLevel(2),
angleLevel(2),
angleLevel(2),//p
angleLevel(2),
angleLevel(2),
angleLevel(2),//br
angleLevel(2),
angleLevel(1),
angleLevel(1),//description
angleLevel(1),
angleLevel(0),
angleLevel(0),//idea-plugin
angleLevel(0)
)
)
}
fun testRainbowForXML() {
@Language("XML") val code =
"""
@@ -28,44 +103,47 @@ class RainbowXMLTest : LightJavaCodeInsightFixtureTestCase() {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
doHighlighting.getBrackets().shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(1),
angleLevel(1),
angleLevel(0),
angleLevel(0)
doHighlighting
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.shouldBe(
arrayOf(
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(0),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(1),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(2),
angleLevel(1),
angleLevel(1),
angleLevel(0),
angleLevel(0)
)
)
)
}
}
@@ -25,7 +25,11 @@ public class Test<T> {
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()
assertFalse(doHighlighting.isEmpty())
val highlightSize = doHighlighting.getBrackets().size
val highlightSize = doHighlighting.filter { brackets.contains(it.text.toChar()) }
.filter { it.forcedTextAttributesKey.defaultAttributes.foregroundColor != null }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
.size
assert(highlightSize == 16)
}
@@ -1,15 +1,8 @@
package com.chylex.intellij.coloredbrackets
import com.chylex.intellij.coloredbrackets.visitor.RainbowHighlightVisitor
import com.intellij.codeInsight.daemon.impl.HighlightInfo
import java.awt.Color
val brackets = RainbowHighlighter.getBrackets()
fun List<HighlightInfo>.getBrackets(): Array<Color> {
return this
.filter { it.toolId?.let { id -> id is Class<*> && RainbowHighlightVisitor::class.java.isAssignableFrom(id) } == true }
.map { it.forcedTextAttributesKey.defaultAttributes.foregroundColor }
.toTypedArray()
}
fun CharSequence.toChar() = elementAt(0)
fun roundLevel(level: Int) = RainbowHighlighter.getRainbowColor(RainbowHighlighter.NAME_ROUND_BRACKETS, level)
+3 -18
View File
@@ -6,9 +6,9 @@ plugins {
}
group = "com.chylex.intellij.coloredbrackets"
version = "1.5.0"
version = "1.3.0"
val ideaVersion = "2026.2"
val ideaVersion = "2025.3"
allprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
@@ -27,20 +27,12 @@ allprojects {
}
intellijPlatform {
sandboxContainer.set(layout.buildDirectory.map { it.dir("idea-sandbox") })
pluginConfiguration {
ideaVersion {
sinceBuild.set("262")
sinceBuild.set("253")
untilBuild.set(provider { null })
}
}
pluginVerification {
ides {
current()
}
}
}
kotlin {
@@ -55,8 +47,6 @@ allprojects {
}
subprojects {
version = rootProject.version
intellijPlatform {
buildSearchableOptions = false
}
@@ -64,7 +54,6 @@ subprojects {
idea {
module {
excludeDirs.add(file(".kotlin"))
excludeDirs.add(file("build"))
excludeDirs.add(file("gradle"))
}
@@ -81,10 +70,6 @@ dependencies {
}
}
intellijPlatform {
buildSearchableOptions.set(true)
}
tasks.test {
useJUnit()
}
+2 -1
View File
@@ -6,6 +6,7 @@ dependencies {
intellijPlatform {
clion(ideaVersion)
compatiblePlugin("com.intellij.cidr.lang")
bundledPlugin("com.intellij.clion")
bundledPlugin("org.jetbrains.plugins.clion.radler")
}
}
Binary file not shown.
+1 -3
View File
@@ -1,9 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+8 -7
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,6 +112,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -171,6 +170,7 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -203,14 +203,15 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
Vendored
+32 -22
View File
@@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -23,8 +21,8 @@
@rem
@rem ##########################################################################
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@@ -45,13 +43,13 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
"%COMSPEC%" /c exit 1
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -59,24 +57,36 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
"%COMSPEC%" /c exit 1
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+1 -1
View File
@@ -8,6 +8,6 @@ dependencies {
useInstaller = false
}
bundledModule("intellij.rider.languages")
bundledModule("intellij.rider.cpp.core.languages")
}
}
@@ -1,10 +1,13 @@
<idea-plugin>
<extensions defaultExtensionNs="com.chylex.coloredbrackets">
<bracePairProvider language="C++"
implementationClass="com.chylex.intellij.coloredbrackets.provider.CppBracePairProvider" />
<bracePairProvider language="C#"
implementationClass="com.chylex.intellij.coloredbrackets.provider.CSharpBracePairProvider" />
</extensions>
<extensions defaultExtensionNs="com.intellij">
<highlightVisitor implementation="com.chylex.intellij.coloredbrackets.visitor.CppRainbowVisitor" />
<highlightVisitor implementation="com.chylex.intellij.coloredbrackets.visitor.CSharpRainbowVisitor" />
</extensions>
</idea-plugin>
+2 -2
View File
@@ -2,8 +2,8 @@ rootProject.name = "ColoredBrackets"
pluginManagement {
plugins {
kotlin("jvm") version "2.4.10"
id("org.jetbrains.intellij.platform") version "2.18.1"
kotlin("jvm") version "2.2.20"
id("org.jetbrains.intellij.platform") version "2.11.0"
}
}