mirror of
https://github.com/chylex/IntelliJ-Rainbow-Brackets.git
synced 2025-05-11 03:34:04 +02:00
Fix support for CLion and Rider
This commit is contained in:
parent
4ad30ca3dc
commit
ec78647a17
.idea/runConfigurations
README.mdbuild.gradle.ktsclion
.gitignorebuild.gradle.kts
src/main
kotlin/com/chylex/intellij/coloredbrackets/provider
resources/META-INF
libs
rider
settings.gradle.ktssrc/main/kotlin/com/chylex/intellij/coloredbrackets/provider
24
.idea/runConfigurations/Run_CLion.xml
Normal file
24
.idea/runConfigurations/Run_CLion.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run CLion" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":clion:runIde" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
24
.idea/runConfigurations/Run_IDEA.xml
Normal file
24
.idea/runConfigurations/Run_IDEA.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run IDEA" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":runIde" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
24
.idea/runConfigurations/Run_Rider.xml
Normal file
24
.idea/runConfigurations/Run_Rider.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Rider" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":rider:runIde" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
@ -1,3 +1,7 @@
|
||||
# Colored Brackets
|
||||
|
||||
This is a fork of the [🌈Rainbow Brackets](https://github.com/izhangzhihao/intellij-rainbow-brackets) plugin by [izhangzhihao](https://github.com/izhangzhihao), based on version 6.26.
|
||||
|
||||
## Key Changes
|
||||
|
||||
- Support for CLion and Rider
|
||||
|
@ -1,23 +1,54 @@
|
||||
@file:Suppress("ConvertLambdaToReference")
|
||||
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import kotlin.io.path.Path
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.9.21"
|
||||
id("org.jetbrains.intellij") version "1.17.4"
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
}
|
||||
|
||||
group = "com.chylex.intellij.coloredbrackets"
|
||||
version = "0.0.1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
allprojects {
|
||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
||||
apply(plugin = "org.jetbrains.intellij")
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
intellij {
|
||||
version.set("2023.3")
|
||||
updateSinceUntilBuild.set(false)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs = listOf(
|
||||
"-Xjvm-default=all"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
tasks.buildSearchableOptions {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
excludeDirs.add(file("gradle"))
|
||||
}
|
||||
}
|
||||
|
||||
intellij {
|
||||
type.set("IU")
|
||||
version.set("2023.3")
|
||||
updateSinceUntilBuild.set(false)
|
||||
|
||||
plugins.set(
|
||||
listOf(
|
||||
@ -42,13 +73,7 @@ intellij {
|
||||
)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(fileTree("libs"))
|
||||
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("io.kotest:kotest-assertions-core:5.8.0") {
|
||||
exclude(group = "org.jetbrains.kotlin")
|
||||
@ -63,8 +88,42 @@ tasks.test {
|
||||
useJUnit()
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs = listOf(
|
||||
"-Xjvm-default=all"
|
||||
)
|
||||
tasks.buildPlugin {
|
||||
val projectName = rootProject.name
|
||||
val instrumentedJarName = "instrumented-$projectName-$version"
|
||||
|
||||
for (ide in listOf("clion", "rider")) {
|
||||
val task = project(":$ide").tasks.buildPlugin
|
||||
|
||||
dependsOn(task)
|
||||
|
||||
from(task.map { it.outputs.files.map(::zipTree) }) {
|
||||
include("$ide/lib/instrumented-$ide.jar")
|
||||
into("lib")
|
||||
|
||||
eachFile {
|
||||
val newName = name.replace("instrumented-", "${instrumentedJarName}-")
|
||||
val newPath = relativePath.segments.dropLast(3).plus(newName)
|
||||
relativePath = RelativePath(true, *newPath.toTypedArray())
|
||||
}
|
||||
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
}
|
||||
|
||||
doLast {
|
||||
val expectedPaths = listOf(
|
||||
Path(projectName, "lib", "instrumented-$projectName-$version-clion.jar"),
|
||||
Path(projectName, "lib", "instrumented-$projectName-$version-rider.jar"),
|
||||
Path(projectName, "lib", "instrumented-$projectName-$version.jar"),
|
||||
Path(projectName, "lib", "searchableOptions-$version.jar"),
|
||||
)
|
||||
|
||||
val jarFiles = zipTree(outputs.files.singleFile)
|
||||
|
||||
for (expectedPath in expectedPaths) {
|
||||
val found = jarFiles.find { it.toPath().endsWith(expectedPath) }
|
||||
checkNotNull(found) { "Expected path not found: $expectedPath" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
clion/.gitignore
vendored
Normal file
1
clion/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build/
|
12
clion/build.gradle.kts
Normal file
12
clion/build.gradle.kts
Normal file
@ -0,0 +1,12 @@
|
||||
intellij {
|
||||
type.set("CL")
|
||||
|
||||
plugins.set(listOf(
|
||||
// Built-in
|
||||
"cidr-base-plugin"
|
||||
))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(rootProject)
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.chylex.intellij.coloredbrackets.provider
|
||||
|
||||
import com.intellij.lang.BracePair
|
||||
import com.jetbrains.cidr.lang.parser.OCLexerTokenTypes
|
||||
|
||||
class OCBracePairProvider : BracePairProvider {
|
||||
override fun pairs(): List<BracePair> = listOf(BracePair(OCLexerTokenTypes.LT, OCLexerTokenTypes.GT, false))
|
||||
}
|
BIN
libs/clion.jar
BIN
libs/clion.jar
Binary file not shown.
BIN
libs/rider.jar
BIN
libs/rider.jar
Binary file not shown.
1
rider/.gitignore
vendored
Normal file
1
rider/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build/
|
7
rider/build.gradle.kts
Normal file
7
rider/build.gradle.kts
Normal file
@ -0,0 +1,7 @@
|
||||
intellij {
|
||||
type.set("RD")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(rootProject)
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.chylex.intellij.coloredbrackets.provider
|
||||
|
||||
import com.intellij.lang.BracePair
|
||||
import com.jetbrains.rider.languages.fileTypes.csharp.kotoparser.lexer.CSharpTokenType
|
||||
|
||||
class CSharpBracePairProvider : BracePairProvider {
|
||||
override fun pairs(): List<BracePair> = listOf(
|
||||
BracePair(CSharpTokenType.LPARENTH, CSharpTokenType.RPARENTH, false),
|
||||
BracePair(CSharpTokenType.LBRACE, CSharpTokenType.RBRACE, false),
|
||||
BracePair(CSharpTokenType.LBRACKET, CSharpTokenType.RBRACKET, false),
|
||||
BracePair(CSharpTokenType.LT, CSharpTokenType.GT, false),
|
||||
)
|
||||
}
|
@ -7,9 +7,8 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.LPARENTH
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.RPARENTH
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.psi.CSharpDummyNode
|
||||
import com.jetbrains.rider.languages.fileTypes.csharp.kotoparser.lexer.CSharpTokenType
|
||||
import com.jetbrains.rider.languages.fileTypes.csharp.psi.CSharpDummyNode
|
||||
|
||||
class CSharpRainbowVisitor : RainbowHighlightVisitor() {
|
||||
|
||||
@ -48,8 +47,8 @@ class CSharpRainbowVisitor : RainbowHighlightVisitor() {
|
||||
|
||||
companion object {
|
||||
val map = mapOf(
|
||||
LPARENTH to BracePair(LPARENTH, RPARENTH, true),
|
||||
RPARENTH to BracePair(LPARENTH, RPARENTH, true),
|
||||
CSharpTokenType.LPARENTH to BracePair(CSharpTokenType.LPARENTH, CSharpTokenType.RPARENTH, true),
|
||||
CSharpTokenType.RPARENTH to BracePair(CSharpTokenType.LPARENTH, CSharpTokenType.RPARENTH, true),
|
||||
//LT to BracePair(LT, GT, true),
|
||||
//GT to BracePair(LT, GT, true),
|
||||
)
|
@ -1 +1,11 @@
|
||||
rootProject.name = "ColoredBrackets"
|
||||
|
||||
pluginManagement {
|
||||
plugins {
|
||||
kotlin("jvm") version "1.9.21"
|
||||
id("org.jetbrains.intellij") version "1.17.4"
|
||||
}
|
||||
}
|
||||
|
||||
include("clion")
|
||||
include("rider")
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.chylex.intellij.coloredbrackets.provider
|
||||
|
||||
import com.intellij.lang.BracePair
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.GT
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.LBRACE
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.LBRACKET
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.LT
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.RBRACE
|
||||
import com.jetbrains.rider.ideaInterop.fileTypes.csharp.lexer.CSharpTokenType.RBRACKET
|
||||
|
||||
class CSharpBracePairProvider : BracePairProvider {
|
||||
override fun pairs(): List<BracePair> = listOf(
|
||||
//BracePair(LPARENTH, RPARENTH, false),
|
||||
BracePair(LBRACE, RBRACE, false),
|
||||
BracePair(LBRACKET, RBRACKET, false),
|
||||
BracePair(LT, GT, false),
|
||||
)
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.chylex.intellij.coloredbrackets.provider
|
||||
|
||||
import com.intellij.lang.BracePair
|
||||
import com.jetbrains.cidr.lang.parser.OCTokenTypes
|
||||
|
||||
class OCBracePairProvider : BracePairProvider {
|
||||
override fun pairs(): List<BracePair> = listOf(BracePair(OCTokenTypes.LT, OCTokenTypes.GT, false))
|
||||
}
|
Loading…
Reference in New Issue
Block a user