1
0
mirror of https://github.com/chylex/IntelliJ-Rainbow-Brackets.git synced 2025-09-15 18:32:09 +02:00

14 Commits
main ... v3

121 changed files with 728 additions and 2214 deletions

View File

@@ -1,69 +0,0 @@
## Contribute
NOTE: To view the PSI tree and explore the internal PSI structure of source code, you need to set up your IDE by following [this](https://www.jetbrains.com/help/idea/psi-viewer.html).
For the Rider IDE, please follow: [this](https://rider-support.jetbrains.com/hc/en-us/articles/207327910-How-to-run-JetBrains-Rider-in-Internal-Mode)
For small changes, [Gitpod](https://gitpod.io/#https://github.com/izhangzhihao/intellij-rainbow-brackets) is recommended. [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/izhangzhihao/intellij-rainbow-brackets)
* `gradle test`
* `gradle runIde`
* `gradle buildPlugin`
## Support Us
You can support us by the following actions:
* Star this project
* Share this plugin with your friends
* Rate this plugin on [JetBrains plugin repository](https://plugins.jetbrains.com/plugin/10080-rainbow-brackets)
* Make pull requests
* Report bugs
* Tell us your ideas
* Become a sponsor by donating on [Open Collective](https://opencollective.com/intellij-rainbow-brackets)
* Become a sponsor by donating with AliPay or WeChatPay
* Don't want to use AliPay's mobile App? If you could read Chinese, please use [the official website](https://shenghuo.alipay.com/send/payment/fill.htm) to transfer your donation to my Alipay account(izhangzhihao@hotmail.com). Otherwise, you can try [the English version of Alipay](https://global.alipay.com/) to transfer your donation.
<table>
<tr>
<th width="33%">Open Collective</th>
<th width="33%">AliPay</th>
<th width="33%">WeChatPay</th>
</tr>
<tr></tr>
<tr align="center">
<td>
<a href="https://opencollective.com/intellij-rainbow-brackets" target="_blank">
<img src="https://cdn.jsdelivr.net/gh/YiiGuxing/TranslationPlugin@master/images/open-collective.svg" width="171px" alt="OpenCollective">
</a>
</td>
<td><img src="https://user-images.githubusercontent.com/12044174/85197261-77dd5a80-b312-11ea-9630-51caf7d634f2.jpg"></td>
<td><img src="https://user-images.githubusercontent.com/12044174/85197263-7b70e180-b312-11ea-917a-35eab2ea08ae.jpg"></td>
</tr>
</table>
## Backers
Thank you to all our backers! ❤️ [[Become a backer](https://opencollective.com/intellij-rainbow-brackets#backer)]
<a href="https://opencollective.com/intellij-rainbow-brackets#backers" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/backers.svg?width=890"></a>
## Sponsors
Support this project by becoming a sponsor! 🌈 Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/intellij-rainbow-brackets#sponsor)]
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/0/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/1/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/2/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/3/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/4/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/5/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/6/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/7/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/8/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/9/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/10/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/11/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/12/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/13/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/14/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/15/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/15/avatar.svg"></a>

2
.github/FUNDING.yml vendored
View File

@@ -1,2 +0,0 @@
open_collective: intellij-rainbow-brackets
custom: https://github.com/izhangzhihao/intellij-rainbow-brackets#support-us

View File

@@ -1,57 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug?
assignees: ''
---
Your issue may already be reported!
Please search on the [issues](https://github.com/izhangzhihao/intellij-rainbow-brackets/issues) and the [document](https://github.com/izhangzhihao/intellij-rainbow-brackets/blob/2020.3/README.md) before creating one.
## Please check
- [ ] I already support this project.
- [ ] If you are submitting a feature request, please do consider donating us on [Open Collective](https://opencollective.com/intellij-rainbow-brackets) Or by AliPay/WeChatPay.
- [ ] This issue/feature request is not reported before.
## Your programming languages
## Expected Behavior
* If you're describing a bug, tell us what should happen
* If you're suggesting a change/improvement, tell us how it should work
## Current Behavior
* If describing a bug, tell us what happens instead of the expected behavior
* If suggesting a change/improvement, explain the difference from current behavior
## Possible Solution
Not obligatory, but suggest a fix/reason for the bug, or ideas how to implement the addition or change.
Or what have you tried to resolve this issue.
## Code snippet for reproduce (for bugs)
Please provide code snippet for reproduce bugs.
## Your Environment
* Plugin version:
* IDE & Operating System version, comment your env as below(go to "About IntelliJ IDEA" -> click the "copy" icon):
* NOTE: If you are going to report a bug but WITHOUT your env information, your issue might be closed directly.
```
IntelliJ IDEA 2021.2 (Ultimate Edition)
Build #IU-212.4746.92, built on July 27, 2021
Licensed to IntelliJ Rainbow Brackets / Zhang Zhihao
Subscription is active until February 3, 2022.
For non-commercial open source development only.
Runtime version: 11.0.11+9-b1504.13 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.4
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry: ide.tooltip.initialDelay=900, ide.balloon.shadow.size=0, scala.erase.compiler.process.jdk.once=false
Non-Bundled Plugins: com.intellij.properties.bundle.editor (212.4746.57), com.markskelton.one-dark-theme (5.3.0), lermitage.intellij.extra.icons (1.59.0.203), org.nik.presentation-assistant (1.0.9), kotest-plugin-intellij (1.1.36-IC-2021.1), Pythonid (212.4746.96), org.intellij.scala (2021.2.15), izhangzhihao.rainbow.brackets (6.19), com.intellij.bigdatatools (212.4037.55)
Kotlin: 212-1.5.10-release-IJ4746.92
```

View File

@@ -1,24 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature request
assignees: ''
---
**Please [support us](https://github.com/izhangzhihao/intellij-rainbow-brackets#support-us) before creating a feature request, thanks for your support 😁**
## Please check
- [ ] I already support this project.
- [ ] If you are submitting a feature request, please do consider donating us on [Open Collective](https://opencollective.com/intellij-rainbow-brackets) Or by AliPay/WeChatPay.
- [ ] This issue/feature request is not reported before.
## Your programming languages
## Expected Behavior
* tell us how it will works
## Current Behavior
* explain the difference from current behavior

View File

@@ -1,13 +0,0 @@
collective: intellij-rainbow-brackets
tiers:
- tiers: "*"
labels: ["backer"]
message: "Hey <author> , thanks for supporting us on Open Collective :heart::heart::heart: We'll give a special attention to this issue!"
invitation: |
Hey <author> :wave:,
Thank you for opening an issue/feature request. We will get back to you as soon as we can.
Also, check out our <link> and consider backing us - every little helps!
PS.: We offer `priority` support for all backers. Don't forget to
add `priority` label when you start backing us :smile:

View File

@@ -1,75 +0,0 @@
name: Build
on:
push:
branches:
- '2020.3'
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2.3.4
# Cache Gradle dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2.1.6
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2.1.6
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
# Run detekt, ktlint and tests
- name: Run Linters and Test
run: ./gradlew check
# Run verifyPlugin Gradle task
- name: Verify Plugin
run: ./gradlew verifyPlugin
# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
NAME="intellij-rainbow-brackets"
ARTIFACT="${NAME}-${VERSION}.zip"
echo "::set-output name=ideVersions::$IDE_VERSIONS"
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
echo "::set-output name=artifact::$ARTIFACT"
# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v2.1.6
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}
# Run IntelliJ Plugin Verifier action using GitHub Action
- name: Verify Plugin
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
- name: Upload artifact
uses: actions/upload-artifact@v2.2.3
with:
name: UnZipMe
path: ./build/distributions/${{ steps.properties.outputs.artifact }}

View File

@@ -1,27 +0,0 @@
name: "Label and close wontfix issues"
on:
issues:
types: [opened]
jobs:
Label:
runs-on: ubuntu-latest
steps:
- uses: Naturalclar/issue-action@v2.0.2
with:
title-or-body: "both"
parameters: '[ {"keywords": ["RainbowHighlightVisitor.kt:35", "RainbowHighlightVisitor.kt:68", "RainbowHighlightVisitor.analyze"], "labels": ["invalid"]} ]'
github-token: "${{ secrets.GITHUB_TOKEN }}"
Close:
needs: [Label]
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3.0.14
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 0
days-before-close: 0
stale-issue-message: "This auto generated issue has been automatically marked as wontfix because nothing it's wrong here. If you think there are something really wrong, please reply this issue. Thanks for your cooperation."
stale-issue-label: "wontfix"
only-labels: "invalid"

View File

@@ -1,46 +0,0 @@
# GitHub Actions Workflow created for handling the release process based on the draft release prepared
# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided.
name: Release
on:
release:
types: [prereleased, released]
jobs:
# Prepare and publish the plugin to the Marketplace repository
release:
name: Publish Plugin
runs-on: ubuntu-latest
steps:
# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: 11
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2.3.4
with:
ref: ${{ github.event.release.tag_name }}
# Cache Gradle dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2.1.6
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2.1.6
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
# Publish the plugin to the Marketplace
- name: Publish Plugin
env:
token: ${{ secrets.PUBLISH_TOKEN }}
run: ./gradlew publishPlugin

View File

@@ -1,19 +0,0 @@
name: 'Stale handler'
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@main
id: stale
with:
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
days-before-stale: 30
days-before-close: 5
only-labels: 'PR welcome'
- name: Print outputs
run: echo ${{ join(steps.stale.outputs.*, ',') }}

15
.gitignore vendored
View File

@@ -1,10 +1,7 @@
/.idea/*
!/.idea/icon.png
!/.idea/icon_dark.png
!/.idea/vcs.xml
.sandbox/
.gradle/
build/
*.iml
.DS_Store
out
!/.idea/icon*.png
!/.idea/runConfigurations
/.gradle/
/build/
/libs/

5
.gitpod.Dockerfile vendored
View File

@@ -1,5 +0,0 @@
FROM gitpod/workspace-full
USER gitpod
RUN brew install kotlin

View File

@@ -1,4 +0,0 @@
image:
file: .gitpod.Dockerfile
tasks:
- init: gradle compileKotlin

24
.idea/runConfigurations/Run_CLion.xml generated Normal file
View 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 generated Normal file
View 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=":idea: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 generated Normal file
View 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>

View File

@@ -1 +0,0 @@
11

View File

@@ -1,15 +0,0 @@
pull_request_rules:
- name: Automatic merge on approval
conditions:
- "#approved-reviews-by>=1"
- status-success=Test
actions:
merge:
method: merge
- name: automatically merge dependabot's PRs
conditions:
- author~=^dependabot(|-preview)\[bot\]$
- status-success=Test
actions:
merge:
method: merge

300
README.md
View File

@@ -1,297 +1,9 @@
# Rainbow Brackets
<div align="center">
<a href="https://plugins.jetbrains.com/plugin/10080-rainbow-brackets">
<img src="./src/main/resources/META-INF/pluginIcon.svg" width="320" height="320" alt="logo"/>
</a>
</div>
<h1 align="center">Intellij rainbow brackets</h1>
<p align="center">🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio.</p>
This is a fork of the [🌈Rainbow Brackets](https://github.com/izhangzhihao/intellij-rainbow-brackets) plugin by <a href="https://github.com/izhangzhihao">izhangzhihao</a>.
<p align="center">
<!-- <a href="https://actions-badge.atrox.dev/izhangzhihao/intellij-rainbow-brackets/goto?ref=2020.3"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fizhangzhihao%2Fintellij-rainbow-brackets%2Fbadge%3Fref%3D2020.3&style=flat-square" /></a> -->
<!-- <a href="https://github.com/izhangzhihao/intellij-rainbow-brackets/releases"><img src="https://img.shields.io/github/release/izhangzhihao/intellij-rainbow-brackets.svg?style=flat-square"></a> -->
<a href="https://plugins.jetbrains.com/plugin/10080-rainbow-brackets"><img src="https://img.shields.io/jetbrains/plugin/r/stars/10080?style=flat-square"></a>
<a href="https://plugins.jetbrains.com/embeddable/install/10080"><img src="https://img.shields.io/jetbrains/plugin/d/10080-rainbow-brackets.svg?style=flat-square"></a>
<a href="https://plugins.jetbrains.com/plugin/10080-rainbow-brackets"><img src="https://img.shields.io/jetbrains/plugin/v/10080-rainbow-brackets.svg?style=flat-square"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets#backer"><img src="https://img.shields.io/opencollective/backers/intellij-rainbow-brackets?style=flat-square"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets#sponsor"><img src="https://img.shields.io/opencollective/sponsors/intellij-rainbow-brackets?style=flat-square"></a>
</p>
## Changes
<br>
- [Change log](https://github.com/izhangzhihao/intellij-rainbow-brackets/blob/2020.3/CHANGELOG.md)
- [Compatibility](#compatibility)
- [Supported languages](#supported-languages)
- [Author's choice](#authors-choice)
- [Sponsored By CodeStream](#sponsored-by-codestream)
- [Install](#install)
- [Screenshots](#screenshots)
- [Customize colors](#customize-colors)
- [Use color generator](#use-color-generator)
- [Config file path](#config-file-path)
- [HTML code in js](#html-code-in-js)
- [Kotlin function literal braces and arrow](#kotlin-function-literal-braces-and-arrow)
- [Disable rainbow brackets for specific languages](#disable-rainbow-brackets-for-specific-languages)
- [Contribute](#contribute)
- [Support Us](#support-us)
- [Backers](#backers)
- [Sponsors](#sponsors)
- [Acknowledgements](#acknowledgements)
## Compatibility
IntelliJ IDEA, PhpStorm, WebStorm, PyCharm, RubyMine, AppCode, CLion, Gogland, DataGrip, Rider, MPS, Android Studio, HUAWEI DevEco Studio, DataSpell, Code With Me
## Supported languages
Java, Scala, Clojure, Kotlin, Python, Haskell, Agda, Rust, JavaScript, TypeScript, Erlang, Go, Groovy, Ruby, Elixir, ObjectiveC, PHP, HTML, XML, SQL, Apex language, C#, Dart, Pug/Jade, Bash, Vue.js, C# Razor Pages, GLSL(the OpenGL Shading Language), Go Template, C++, C...
## Author's choice
Rainbow Brackets + One Dark Theme + Nyan Progress Bar + [Fira Code](https://github.com/tonsky/FiraCode) (Font)
## Sponsored By [CodeStream](https://sponsorlink.codestream.com/?utm_source=jbmarket&utm_campaign=jbrainbowbrackets&utm_medium=banner)
[![https://codestream.com](https://alt-images.codestream.com/codestream_logo_jbrainbowbrackets.png)](https://sponsorlink.codestream.com/?utm_source=jbmarket&utm_campaign=jbrainbowbrackets&utm_medium=banner)
Eliminate context switching and costly distractions. Create and merge PRs and perform code reviews from inside your IDE while using jump-to-definition, your keybindings, and other IDE favorites. [Learn more](https://sponsorlink.codestream.com/?utm_source=jbmarket&utm_campaign=jbrainbowbrackets&utm_medium=banner)!
Development powered by [JetBrains](https://www.jetbrains.com/?from=IntelliJRainbowBrackets).
[![https://www.jetbrains.com/?from=IntelliJRainbowBrackets](./screenshots/jetbrains.svg)](https://www.jetbrains.com/?from=IntelliJRainbowBrackets)
Whichever technologies you use, there's a JetBrains tool to match.
## Install
<a href="https://plugins.jetbrains.com/embeddable/install/10080">
<img src="https://user-images.githubusercontent.com/12044174/123105697-94066100-d46a-11eb-9832-338cdf4e0612.png" width="300"/>
</a>
Or you could install it inside your IDE:
For Windows & Linux - <kbd>File</kbd> > <kbd>Settings</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for "Rainbow Brackets"</kbd> > <kbd>Install Plugin</kbd> > <kbd>Restart IntelliJ IDEA</kbd>
For Mac - <kbd>IntelliJ IDEA</kbd> > <kbd>Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for "Rainbow Brackets"</kbd> > <kbd>Install Plugin</kbd> > <kbd>Restart IntelliJ IDEA</kbd>
### Install snapshot build
You can download the latest snapshot build from [here](https://github.com/izhangzhihao/intellij-rainbow-brackets/actions/workflows/build.yml?query=workflow%3ABuild), just click the latest build and click the 'Artifacts' tab.(You need logged in via github) After the snapshot build downloaded, unzip it(via `unzip UnZipMe.zip`), and install the zip file(intellij-rainbow-brackets.zip[]()) by `Install Plugin from Disk...`.
## Screenshots
* Java
![](./screenshots/with-java.png)
![](./screenshots/with-material-theme-ui.png)
* Scala
![](./screenshots/with-scala.png)
* Clojure
![](./screenshots/with-Clojure.png)
* Kotlin
![](./screenshots/with-kotlin.png)
* HTML/XML
![](./screenshots/with-HTML.png)
* Scope highlighting
**The highlight effects will not remove after release the shortcuts, but press `ESC` key can do this. You could also config `Press any key to remove the highlighting effect` in setting page.**
<kbd>Ctrl + Button3</kbd>(Windows & Linux) or <kbd>Meta+ Button3</kbd>(Mac):
NOTE: <kbd>Button3</kbd> means "Secondary Click (click or tap with two fingers)" on Mac os, "Right click" for Windows or Linux.
![](https://user-images.githubusercontent.com/10737066/40234968-46593fe2-5adb-11e8-8ea8-0026fad86ca9.gif)
<kbd>Alt + Button3</kbd>:
NOTE: <kbd>Button3</kbd> means "Secondary Click (click or tap with two fingers)" on Mac os, "Right click" for Windows or Linux.
![](https://user-images.githubusercontent.com/10737066/40235004-642dfe54-5adb-11e8-9fd7-648b92fab8f5.gif)
* Rainbow indent guide lines
![](https://user-images.githubusercontent.com/10737066/65765792-c41cb500-e15b-11e9-8877-2239c6afa7bf.gif)
* looking forward to your screenshots(PR welcome!)
## Customize colors
<kbd>Settings/Preferences</kbd> > <kbd>Editor</kbd> > <kbd>Color Scheme</kbd> > <kbd>Rainbow Brackets</kbd>:
![Customize colors](./screenshots/customize-colors.png)
## Use color generator
If you didn't like the build-in colors, or want some new color but don't want to try out and pick colors. Please use color generator.
<kbd>Settings/Preferences</kbd> > <kbd>Other Settings</kbd> > <kbd>Rainbow Brackets</kbd> > <kbd>Use color generator</kbd>
If you turn on this option, we will auto generate some colors for you.
### Advanced options of color generator
If you need more control, you can decide the options of color generator by edit [the config file](#config-file-path),
The value of the option `customColorGeneratorOption` is a json object, available options are:
```hue``` Controls the hue of the generated color. You can pass a string representing a color name: ```red```, ```orange```, ```yellow```, ```green```, ```blue```, ```purple```, ```pink``` and ```monochrome``` are currently supported. If you pass a hexidecimal color string such as ```#00FFFF```, color generator will extract its hue value and use that to generate colors.
```luminosity``` Controls the luminosity of the generated color. You can specify a string containing ```bright```, ```light``` or ```dark```.
Please make sure the value of the option `customColorGeneratorOption` is escaped in xml format,
you can use [this tool](https://www.freeformatter.com/xml-escape.html#ad-output) to do this. Please don't forget to restart your IDE after change the config file.
```xml
<application>
<component name="RainbowSettings">
<option name="useColorGenerator" value="true" />
<option name="customColorGeneratorOption" value="{&quot;luminosity&quot;: &quot;light&quot;,&quot;hue&quot;: &quot;blue&quot;}"/>
</component>
</application>
```
### Want to config the number of colors?
<kbd>Settings/Preferences</kbd> > <kbd>Other Settings</kbd> > <kbd>Rainbow Brackets</kbd> > `Number of colors`: 5 or more
And you can use the color generator and config you number of colors at the same time.
NOTE: For default and darcula color scheme(`Editor -> Color Scheme -> Rainbow Brackets -> Scheme`) the color number is 10, for the other scheme the number is 5, if your number is bigger than the number, you can config them in the config file.
If the color is not exist, we will use color generator to generator it for you.
Please follow [the official guide](https://www.jetbrains.com/help/idea/configuring-colors-and-fonts.html#share-color-scheme):
* `Export a color scheme as XML`
* Edit the xml file, put `ROUND_BRACKETS_RAINBOW_COLOR5` to `ROUND_BRACKETS_RAINBOW_COLOR100` to match your number just like [the default color scheme](./src/main/resources/colorSchemes/rainbow-color-default-darcula.xml).
* `Import a color scheme`
## Config file path
If you want to customize the advanced configuration, you could edit the config file then restart your IDE.
Config file path in `APP_CONFIG/rainbow_brackets.xml`.
In MAC OS env maybe like `~/Library/Preferences/IntelliJIdea2020.2/options/rainbow_brackets.xml`.
If you are using the ToolBox, then it will be like `~/Library/ApplicationSupport/JetBrains/IntelliJIdea2020.2/options/rainbow_brackets.xml`
In Linux env maybe like `~/.IntelliJIdea/config/options/rainbow_brackets.xml`.
In Windows env maybe like `C:\Users\izhangzhihao\.IntelliJIdea2020.2\config\options\rainbow_brackets.xml`.
## HTML code in js
To enable rainbow brackets for HTML inside js code like this:
```javascript
var html = '<div><div><div>Hello</div></div></div>';
```
This plugin will automatically override color scheme property "HTML_CODE" [cause our rainbow color been covered by intellij built-in functionality](https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000117450-My-HighlightVisitor-been-covered-by-intellij-built-in-functionality).
You still could set `<option name="rainbowifyHTMLInsideJS" value="false" />` in config file to disable.
## Kotlin function literal braces and arrow
To enable rainbow brackets for multiple level lambda Kotlin code like this:
```kotlin
event.throwable?.let { throwable ->
IdeErrorsDialog.findPluginId(throwable)?.let { pluginId ->
PluginManager.getPlugin(pluginId)?.let { ideaPluginDescriptor ->
if (!ideaPluginDescriptor.isBundled) {
bean.pluginName = ideaPluginDescriptor.name
bean.pluginVersion = ideaPluginDescriptor.version
}
}
}
}
```
This plugin will automatically override color scheme property "KOTLIN_FUNCTION_LITERAL_BRACES_AND_ARROW" cause our rainbow color is being covered by kotlin plugin built-in functionality.
You still could set `<option name="rainbowifyKotlinFunctionLiteralBracesAndArrow" value="false" />` in config file to disable.
## Disable rainbow brackets for specific languages
<kbd>Settings/Preferences</kbd> > <kbd>Other Settings</kbd> > <kbd>Rainbow Brackets</kbd> > `Do NOT rainbowify these languages (name or extension, comma separated)`:
NOTE: You can use **name** of language or **extension** of file name(The names should be **lowercase**).
## Contribute
NOTE: To view the PSI tree and explore the internal PSI structure of source code, you need to set up your IDE by following [this](https://www.jetbrains.com/help/idea/psi-viewer.html).
For the Rider IDE, please follow: [this](https://rider-support.jetbrains.com/hc/en-us/articles/207327910-How-to-run-JetBrains-Rider-in-Internal-Mode)
* `gradle test`
* `gradle runIde`
* `gradle buildPlugin`
## Support Us
You can support us by the following actions:
* Star this project
* Share this plugin with your friends
* Rate this plugin on [JetBrains plugin repository](https://plugins.jetbrains.com/plugin/10080-rainbow-brackets)
* Make pull requests
* Report bugs
* Tell us your ideas
* Become a sponsor by donating on [Open Collective](https://opencollective.com/intellij-rainbow-brackets)
* Become a sponsor by donating with AliPay or WeChatPay
* Don't want to use AliPay's mobile App? If you could read Chinese, please use [the official website](https://shenghuo.alipay.com/send/payment/fill.htm) to transfer your donation to my Alipay account(izhangzhihao@hotmail.com). Otherwise, you can try [the English version of Alipay](https://global.alipay.com/) to transfer your donation.
<table>
<tr>
<th width="33%">Open Collective</th>
<th width="33%">AliPay</th>
<th width="33%">WeChatPay</th>
</tr>
<tr></tr>
<tr align="center">
<td>
<a href="https://opencollective.com/intellij-rainbow-brackets" target="_blank">
<img src="https://opencollective.com/static/images/opencollectivelogo-footer-n.svg" width="171px" alt="OpenCollective">
</a>
</td>
<td><img src="https://user-images.githubusercontent.com/12044174/85197261-77dd5a80-b312-11ea-9630-51caf7d634f2.jpg"></td>
<td><img src="https://user-images.githubusercontent.com/12044174/85197263-7b70e180-b312-11ea-917a-35eab2ea08ae.jpg"></td>
</tr>
</table>
## Backers
Thank you to all our backers! ❤️ [[Become a backer](https://opencollective.com/intellij-rainbow-brackets#backer)]
<a href="https://opencollective.com/intellij-rainbow-brackets#backers" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/backers.svg?width=890"></a>
## Sponsors
Support this project by becoming a sponsor! 🌈 Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/intellij-rainbow-brackets#sponsor)]
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/0/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/1/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/2/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/3/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/4/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/5/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/6/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/7/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/8/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/9/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/10/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/11/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/12/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/13/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/14/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/intellij-rainbow-brackets/sponsor/15/website" target="_blank"><img src="https://opencollective.com/intellij-rainbow-brackets/sponsor/15/avatar.svg"></a>
## Acknowledgements
Intellij-rainbow-brackets is heavily inspired by [Rainbow Brackets for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=2gua.rainbow-brackets)
- Added support for Rider
- Restructured the project for easier support of Rider and CLion
- Removed post-update notification

View File

@@ -1,103 +1,109 @@
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.*
@file:Suppress("SpellCheckingInspection")
import org.jetbrains.intellij.IntelliJPluginExtension
import org.jetbrains.intellij.tasks.BuildPluginTask
import org.jetbrains.intellij.tasks.BuildSearchableOptionsTask
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val name: String by project
val ideaVersion: String by project
val kotlinVersion: String by project
val javaVersion: String by project
val kotlinLanguageVersion: String by project
val kotlinTargetVersion: String by project
val pluginVerifierIdeVersions: String by project
val publishChannels: String by project
plugins {
id("org.jetbrains.intellij") version "1.9.0"
id("com.adarshr.test-logger") version "3.2.0"
id("org.jetbrains.kotlin.jvm") version "1.7.20"
id("idea")
idea
kotlin("jvm")
id("org.jetbrains.intellij") apply false
}
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://maven-central.storage-download.googleapis.com/repos/central/data/")
maven(url = "https://maven.aliyun.com/nexus/content/groups/public/")
maven(url = "https://www.jetbrains.com/intellij-repository/releases")
maven(url = "https://www.jetbrains.com/intellij-repository/snapshots")
}
group = "com.chylex.intellij.rainbowbrackets"
version = "6.26-chylex-3"
intellij {
pluginName.set(name)
val ideVersion = "2023.2.2"
val ideBuild = "232"
version.set(ideaVersion)
//localPath = '/Users/izhangzhihao/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/201.6668.121/IntelliJ IDEA 2020.1 EAP.app/Contents'
//localPath = '/Users/izhangzhihao/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/201.6668.126/CLion.app/Contents'
updateSinceUntilBuild.set(false)
plugins.set(
listOf(
"java",
"java-i18n",
"JavaScriptLanguage",
"DatabaseTools",
"CSS",
"platform-images",
"Groovy",
"properties",
"yaml",
"org.jetbrains.kotlin:203-$kotlinVersion-release-IJ5981.133-1",
"org.intellij.scala:2020.3.21",
"Dart:203.5981.155",
"org.jetbrains.plugins.ruby:203.5981.155",
"com.jetbrains.php:203.5981.155",
"com.jetbrains.sh:203.5981.37",
"com.jetbrains.plugins.jade:203.5981.155",
"org.jetbrains.plugins.go-template:203.5981.155",
"Pythonid:203.5981.155",
)
)
}
tasks {
runIde {
systemProperties["idea.auto.reload.plugins"] = false
jvmArgs = listOf(
"-Xms512m",
"-Xmx2048m",
)
}
publishPlugin {
token.set(System.getenv("token"))
channels.set(publishChannels.split(",").map { it.trim() }.toList())
}
runPluginVerifier {
ideVersions.set(pluginVerifierIdeVersions.split(",").map { it.trim() }.toList())
failureLevel.set(listOf(COMPATIBILITY_PROBLEMS))
}
testlogger {
theme = com.adarshr.gradle.testlogger.theme.ThemeType.MOCHA
}
idea {
module {
excludeDirs.add(file("gradle"))
}
}
dependencies {
//implementation("org.eclipse.mylyn.github:org.eclipse.egit.github.core:5.11.0.202103091610-r") {
// exclude("gson")
//}
compileOnly(fileTree("libs"))
testImplementation("io.kotest:kotest-assertions-core:5.5.0")
implementation(project(":clion"))
implementation(project(":idea"))
implementation(project(":rider"))
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.intellij")
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
maven(url = "https://www.jetbrains.com/intellij-repository/releases")
maven(url = "https://www.jetbrains.com/intellij-repository/snapshots")
}
dependencies {
testImplementation("junit:junit:4.13.2")
testImplementation("io.kotest:kotest-assertions-core:5.5.5")
}
kotlin {
jvmToolchain(17)
}
configure<IntelliJPluginExtension> {
version.set(ideVersion)
updateSinceUntilBuild.set(false)
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf(
"-Xjvm-default=all"
)
}
tasks.test {
useJUnit()
}
tasks.getByName<BuildSearchableOptionsTask>("buildSearchableOptions") {
enabled = false
}
tasks.getByName<PatchPluginXmlTask>("patchPluginXml") {
sinceBuild.set(ideBuild)
}
tasks.getByName<BuildPluginTask>("buildPlugin") {
eachFile {
name = name.replaceFirst("instrumented-", "instrumented-RainbowBrackets-")
relativePath.segments[0] = "RainbowBrackets"
}
includeEmptyDirs = false
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.languageVersion = kotlinLanguageVersion
kotlinOptions.apiVersion = kotlinTargetVersion
kotlinOptions.jvmTarget = javaVersion
kotlinOptions.freeCompilerArgs = listOf("-Xskip-runtime-version-check", "-Xjsr305=strict")
tasks.register<Zip>("buildPlugin") {
group = "intellij"
for (project in listOf("clion", "idea", "rider")) {
val buildPlugin = project(":$project").tasks.getByName("buildPlugin")
val outputs = buildPlugin.outputs.files.map(::zipTree)
dependsOn(buildPlugin)
from(outputs) {
include("RainbowBrackets/lib/instrumented-RainbowBrackets-$project-$version.jar")
}
if (project == "idea") {
from(outputs) {
include("RainbowBrackets/lib/searchableOptions-$version.jar")
}
}
}
destinationDirectory = layout.buildDirectory.dir("distributions")
}

1
clion/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build/

16
clion/build.gradle.kts Normal file
View File

@@ -0,0 +1,16 @@
plugins {
id("org.jetbrains.intellij")
}
intellij {
type.set("CL")
plugins.set(listOf(
// Built-in
"cidr-base-plugin"
))
}
dependencies {
implementation(project(":idea"))
}

View File

@@ -0,0 +1,8 @@
package com.github.izhangzhihao.rainbow.brackets.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))
}

View File

@@ -1,6 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="ObjectiveC"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.OCBracePairProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -1,12 +1,2 @@
group="com.github.izhangzhihao"
name="Rainbow Brackets"
org.gradle.parallel=true
ideaVersion=IU-203.5981.155
javaVersion=11
kotlinVersion=1.4.21
kotlinLanguageVersion=1.4
kotlinTargetVersion=1.4
version=6.26
publishChannels=Stable
kotlin.stdlib.default.dependency=false
pluginVerifierIdeVersions=WS-2020.3, IIC-2021.1, IIU-2021.2

Binary file not shown.

View File

@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

294
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or 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.
@@ -17,67 +17,99 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# 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/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# This is normally unused
# 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

15
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
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

1
idea/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build/

33
idea/build.gradle.kts Normal file
View File

@@ -0,0 +1,33 @@
plugins {
id("org.jetbrains.intellij")
}
intellij {
type.set("IU")
plugins.set(
listOf(
// Built-in
"Groovy",
"JavaScript",
"com.intellij.css",
"com.intellij.database",
"com.intellij.java",
"org.intellij.plugins.markdown",
"org.jetbrains.kotlin",
"org.jetbrains.plugins.yaml",
// Downloaded
"Dart:232.8660.129", // https://plugins.jetbrains.com/plugin/6351-dart/versions/stable
"Pythonid:232.9921.47", // https://plugins.jetbrains.com/plugin/631-python/versions
"com.jetbrains.php:232.9921.55", // https://plugins.jetbrains.com/plugin/6610-php/versions
"com.jetbrains.sh:232.8660.88", // https://plugins.jetbrains.com/plugin/13122-shell-script/versions
"org.intellij.scala:2023.2.23", // https://plugins.jetbrains.com/plugin/1347-scala/versions
"org.jetbrains.plugins.go-template:232.9921.89", // https://plugins.jetbrains.com/plugin/10581-go-template/versions
"org.jetbrains.plugins.ruby:232.9921.47", // https://plugins.jetbrains.com/plugin/1293-ruby/versions
)
)
}
tasks.buildSearchableOptions {
enabled = true
}

View File

@@ -3,12 +3,17 @@ package com.github.izhangzhihao.rainbow.brackets
import com.github.izhangzhihao.rainbow.brackets.provider.BracePairProvider
import com.github.izhangzhihao.rainbow.brackets.util.memoize
import com.intellij.codeInsight.highlighting.BraceMatchingUtil
import com.intellij.lang.*
import com.intellij.lang.BracePair
import com.intellij.lang.CompositeLanguage
import com.intellij.lang.Language
import com.intellij.lang.LanguageBraceMatching
import com.intellij.lang.LanguageExtension
import com.intellij.lang.PairedBraceMatcher
import com.intellij.psi.tree.IElementType
object BracePairs {
private val providers = LanguageExtension<BracePairProvider>("izhangzhihao.rainbow.brackets.bracePairProvider")
private val providers = LanguageExtension<BracePairProvider>("com.chylex.intellij.rainbowbrackets.bracePairProvider")
private val bracePairs =
Language.getRegisteredLanguages()
@@ -74,4 +79,4 @@ inline val Language.bracePairs: MutableMap<String, MutableList<BracePair>>?
get() = BracePairs.getBracePairs(this)
inline val Language.braceTypeSet: Set<IElementType>
get() = BracePairs.braceTypeSet(this)
get() = BracePairs.braceTypeSet(this)

View File

@@ -19,7 +19,6 @@ import org.intellij.lang.annotations.Language
import org.jetbrains.annotations.TestOnly
import java.awt.Color
import java.awt.Font
import java.util.UUID
object RainbowHighlighter {

View File

@@ -3,7 +3,6 @@ package com.github.izhangzhihao.rainbow.brackets.action
import com.github.izhangzhihao.rainbow.brackets.RainbowInfo
import com.github.izhangzhihao.rainbow.brackets.settings.RainbowSettings
import com.github.izhangzhihao.rainbow.brackets.util.alphaBlend
import com.github.izhangzhihao.rainbow.brackets.util.create
import com.intellij.codeInsight.highlighting.HighlightManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColorsManager
@@ -11,7 +10,7 @@ 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.*
import java.util.LinkedList
class ScopeHighlightingAction : AbstractScopeHighlightingAction() {
@@ -33,4 +32,4 @@ class ScopeHighlightingAction : AbstractScopeHighlightingAction() {
return highlighters
}
}
}

View File

@@ -3,7 +3,6 @@ package com.github.izhangzhihao.rainbow.brackets.action
import com.github.izhangzhihao.rainbow.brackets.RainbowInfo
import com.github.izhangzhihao.rainbow.brackets.settings.RainbowSettings
import com.github.izhangzhihao.rainbow.brackets.util.alphaBlend
import com.github.izhangzhihao.rainbow.brackets.util.create
import com.intellij.codeInsight.highlighting.HighlightManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColorsManager
@@ -12,7 +11,7 @@ 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.*
import java.util.LinkedList
class ScopeOutsideHighlightingRestrainAction : AbstractScopeHighlightingAction() {
@@ -50,4 +49,4 @@ class ScopeOutsideHighlightingRestrainAction : AbstractScopeHighlightingAction()
return highlighters
}
}
}

View File

@@ -12,7 +12,15 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.KtBlockExpression
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassBody
import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.KtFunctionLiteral
import org.jetbrains.kotlin.psi.KtLabelReferenceExpression
import org.jetbrains.kotlin.psi.KtLabeledExpression
import org.jetbrains.kotlin.psi.KtLambdaExpression
import java.awt.Font
@@ -75,4 +83,4 @@ class KotlinLabelAnnotator : Annotator {
}
}
}
}

View File

@@ -1,7 +1,12 @@
package com.github.izhangzhihao.rainbow.brackets.indents
import com.github.izhangzhihao.rainbow.brackets.RainbowInfo
import com.github.izhangzhihao.rainbow.brackets.util.*
import com.github.izhangzhihao.rainbow.brackets.util.alphaBlend
import com.github.izhangzhihao.rainbow.brackets.util.endOffset
import com.github.izhangzhihao.rainbow.brackets.util.findNextSibling
import com.github.izhangzhihao.rainbow.brackets.util.findPrevSibling
import com.github.izhangzhihao.rainbow.brackets.util.lineNumber
import com.github.izhangzhihao.rainbow.brackets.util.startOffset
import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.SoftWrap
@@ -255,4 +260,4 @@ class RainbowIndentGuideRenderer: CustomHighlighterRenderer {
lastChild?.findPrevSibling(XML_END_TAG_START_CONDITION)?.let { document.lineNumber(it.startOffset) }
}
}
}

View File

@@ -28,7 +28,7 @@ import com.intellij.util.containers.IntStack
import com.intellij.util.text.CharArrayUtil
import java.lang.StrictMath.abs
import java.lang.StrictMath.min
import java.util.*
import java.util.Collections
/** From [com.intellij.codeInsight.daemon.impl.IndentsPass]
* Commit history: https://sourcegraph.com/github.com/JetBrains/intellij-community/-/blob/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IndentsPass.java#tab=history

View File

@@ -1,6 +1,10 @@
package com.github.izhangzhihao.rainbow.brackets.indents
import com.intellij.codeHighlighting.*
import com.intellij.codeHighlighting.Pass
import com.intellij.codeHighlighting.TextEditorHighlightingPass
import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory
import com.intellij.codeHighlighting.TextEditorHighlightingPassFactoryRegistrar
import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
@@ -21,4 +25,4 @@ class RainbowIndentsPassFactory :
false
)
}
}
}

View File

@@ -1,6 +1,9 @@
package com.github.izhangzhihao.rainbow.brackets.provider
import com.goide.template.GoTemplateTypes.*
import com.goide.template.GoTemplateTypes.LDOUBLE_BRACE
import com.goide.template.GoTemplateTypes.LPAREN
import com.goide.template.GoTemplateTypes.RDOUBLE_BRACE
import com.goide.template.GoTemplateTypes.RPAREN
import com.intellij.lang.BracePair
class GoTemplateProvider : BracePairProvider {
@@ -8,4 +11,4 @@ class GoTemplateProvider : BracePairProvider {
BracePair(LDOUBLE_BRACE, RDOUBLE_BRACE, true),
BracePair(LPAREN, RPAREN, true)
)
}
}

View File

@@ -2,7 +2,12 @@ package com.github.izhangzhihao.rainbow.brackets.settings
import com.github.izhangzhihao.rainbow.brackets.RainbowHighlighter
import com.github.izhangzhihao.rainbow.brackets.settings.form.RainbowOptionsPanel
import com.intellij.application.options.colors.*
import com.intellij.application.options.colors.ColorAndFontOptions
import com.intellij.application.options.colors.ColorAndFontPanelFactory
import com.intellij.application.options.colors.ColorAndFontSettingsListener
import com.intellij.application.options.colors.NewColorAndFontPanel
import com.intellij.application.options.colors.PreviewPanel
import com.intellij.application.options.colors.SchemesPanel
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorAndFontDescriptorsProvider
import com.intellij.openapi.options.colors.ColorDescriptor
@@ -52,4 +57,4 @@ class RainbowColorsPageFactory : ColorAndFontPanelFactory, ColorAndFontDescripto
}
}
}
}

View File

@@ -21,7 +21,6 @@ class RainbowSettings : PersistentStateComponent<RainbowSettings> {
var isShowRainbowIndentGuides = true
var isDoNOTRainbowifyBracketsWithoutContent = false
var isDoNOTRainbowifyTheFirstLevel = false
var version = "Unknown"
var isRainbowifyHTMLInsideJS = true
var isRainbowifyKotlinLabel = true
var isRainbowifyKotlinFunctionLiteralBracesAndArrow = true
@@ -36,7 +35,6 @@ class RainbowSettings : PersistentStateComponent<RainbowSettings> {
var disableRainbowIndentsInZenMode = true
var useColorGenerator = false
var customColorGeneratorOption: String? = null
var showNotificationOnUpdate = true
var rainbowifyTagNameInXML = false
var doNOTRainbowifyTemplateString = false
var doNOTRainbowifyBigFiles = true
@@ -60,4 +58,4 @@ class RainbowSettings : PersistentStateComponent<RainbowSettings> {
val instance: RainbowSettings
get() = ApplicationManager.getApplication().getService(RainbowSettings::class.java)
}
}
}

View File

@@ -2,7 +2,11 @@ package com.github.izhangzhihao.rainbow.brackets.settings.form
import com.github.izhangzhihao.rainbow.brackets.RainbowHighlighter
import com.github.izhangzhihao.rainbow.brackets.settings.RainbowSettings
import com.intellij.application.options.colors.*
import com.intellij.application.options.colors.ColorAndFontOptions
import com.intellij.application.options.colors.ColorAndFontSettingsListener
import com.intellij.application.options.colors.OptionsPanel
import com.intellij.application.options.colors.SchemesPanel
import com.intellij.application.options.colors.TextAttributesDescription
import com.intellij.ide.util.PropertiesComponent
import com.intellij.ui.ColorPanel
import com.intellij.ui.components.JBCheckBox
@@ -259,4 +263,4 @@ class RainbowOptionsPanel(
}
}
private fun <E> List<E>.indexOfOrNull(idx: Int): E? = if (idx < this.size) this[idx] else null
private fun <E> List<E>.indexOfOrNull(idx: Int): E? = if (idx < this.size) this[idx] else null

View File

@@ -5,7 +5,22 @@ import com.intellij.codeInsight.daemon.impl.HighlightVisitor
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.jetbrains.python.PyTokenTypes.*
import com.jetbrains.python.PyTokenTypes.BREAK_KEYWORD
import com.jetbrains.python.PyTokenTypes.CLASS_KEYWORD
import com.jetbrains.python.PyTokenTypes.CONTINUE_KEYWORD
import com.jetbrains.python.PyTokenTypes.DEF_KEYWORD
import com.jetbrains.python.PyTokenTypes.ELIF_KEYWORD
import com.jetbrains.python.PyTokenTypes.ELSE_KEYWORD
import com.jetbrains.python.PyTokenTypes.EXCEPT_KEYWORD
import com.jetbrains.python.PyTokenTypes.FINALLY_KEYWORD
import com.jetbrains.python.PyTokenTypes.FOR_KEYWORD
import com.jetbrains.python.PyTokenTypes.IF_KEYWORD
import com.jetbrains.python.PyTokenTypes.RAISE_KEYWORD
import com.jetbrains.python.PyTokenTypes.RETURN_KEYWORD
import com.jetbrains.python.PyTokenTypes.TRY_KEYWORD
import com.jetbrains.python.PyTokenTypes.WHILE_KEYWORD
import com.jetbrains.python.PyTokenTypes.WITH_KEYWORD
import com.jetbrains.python.PyTokenTypes.YIELD_KEYWORD
import com.jetbrains.python.psi.PyStatement
@@ -84,4 +99,4 @@ class PythonRainbowVisitor : RainbowHighlightVisitor() {
)
}
}
}
}

View File

@@ -2,8 +2,8 @@
<extensions defaultExtensionNs="com.intellij">
<highlightVisitor implementation="com.github.izhangzhihao.rainbow.brackets.visitor.ReactJSXRainbowVisitor"/>
</extensions>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="JavaScript"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.TSBracePairProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -1,6 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="Dart"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.DartBracePairProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -1,6 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="GoTemplate"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.GoTemplateProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -1,6 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="Groovy"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.GroovyBracePairProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -1,5 +1,5 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="kotlin"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.KotlinBracePairProvider"/>
</extensions>
@@ -9,4 +9,4 @@
<annotator language="kotlin"
implementationClass="com.github.izhangzhihao.rainbow.brackets.annotator.KotlinLabelAnnotator"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -1,6 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="PHP"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.PHPBracePairProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -0,0 +1,106 @@
<idea-plugin require-restart="true">
<id>com.chylex.intellij.rainbowbrackets</id>
<name>Rainbow Brackets</name>
<vendor url="https://chylex.com">chylex</vendor>
<description><![CDATA[
Fork of the <a href="https://github.com/izhangzhihao/intellij-rainbow-brackets">🌈Rainbow Brackets</a> plugin by <a href="https://github.com/izhangzhihao">izhangzhihao</a>.
]]></description>
<change-notes><![CDATA[
<p>6.26-chylex-3</p>
<ul>
<li>Prepared fork for standalone release.</li>
</ul>
<br />
<p>6.26-chylex-2</p>
<ul>
<li>Fixed Rider support.</li>
</ul>
<br/>
<p>6.26-chylex-1</p>
<ul>
<li>Removed post-update notification.</li>
</ul>
<br/>
<p>6.26</p>
<ul>
<li>Original version the fork is based on.</li>
</ul>
]]>
</change-notes>
<!-- please see https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html
on how to target different products -->
<depends>com.intellij.modules.lang</depends>
<depends optional="true" config-file="kotlin-brackets.xml">org.jetbrains.kotlin</depends>
<depends optional="true" config-file="JSX.xml">JavaScript</depends>
<depends optional="true" config-file="dart-brackets.xml">Dart</depends>
<depends optional="true" config-file="groovy-brackets.xml">org.intellij.groovy</depends>
<depends optional="true" config-file="csharp-brackets.xml">com.intellij.modules.rider</depends>
<depends optional="true" config-file="intellij-haskell-annotator.xml">intellij.haskell</depends>
<depends optional="true" config-file="sql-brackets.xml">com.intellij.database</depends>
<depends optional="true" config-file="oc-brackets.xml">com.intellij.modules.clion</depends>
<depends optional="true" config-file="sh-brackets.xml">com.jetbrains.sh</depends>
<depends optional="true" config-file="php-brackets.xml">com.jetbrains.php</depends>
<depends optional="true" config-file="go-template-brackets.xml">org.jetbrains.plugins.go-template</depends>
<depends optional="true" config-file="jade-rainbow-visitor.xml">com.jetbrains.plugins.jade</depends>
<depends optional="true" config-file="python-brackets.xml">com.intellij.modules.python</depends>
<extensionPoints>
<extensionPoint name="bracePairProvider" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass"
implements="com.github.izhangzhihao.rainbow.brackets.provider.BracePairProvider"/>
</extensionPoint>
</extensionPoints>
<extensions defaultExtensionNs="com.intellij">
<!--test only-->
<!--<annotator language="JAVA" implementationClass="com.github.izhangzhihao.rainbow.brackets.annotator.RainbowAnnotator"/>-->
<highlightVisitor implementation="com.github.izhangzhihao.rainbow.brackets.visitor.DefaultRainbowVisitor"/>
<highlightVisitor implementation="com.github.izhangzhihao.rainbow.brackets.visitor.XmlRainbowVisitor"/>
<applicationConfigurable instance="com.github.izhangzhihao.rainbow.brackets.settings.RainbowConfigurable"/>
<applicationService
serviceImplementation="com.github.izhangzhihao.rainbow.brackets.settings.RainbowSettings"/>
<colorAndFontPanelFactory
implementation="com.github.izhangzhihao.rainbow.brackets.settings.RainbowColorsPageFactory"/>
<colorAndFontDescriptorProvider
implementation="com.github.izhangzhihao.rainbow.brackets.settings.RainbowColorsPageFactory"/>
<additionalTextAttributes scheme="Default" file="colorSchemes/rainbow-color-default.xml"/>
<additionalTextAttributes scheme="Darcula" file="colorSchemes/rainbow-color-default-darcula.xml"/>
<!--<errorHandler implementation="com.github.izhangzhihao.rainbow.brackets.util.GitHubErrorReporter"/>-->
<highlightingPassFactory implementation="com.github.izhangzhihao.rainbow.brackets.indents.RainbowIndentsPassFactory"/>
<editorNotificationProvider implementation="com.github.izhangzhihao.rainbow.brackets.RainbowifyBanner"/>
<notificationGroup id="Rainbow Brackets Notification Group" displayType="STICKY_BALLOON"/>
</extensions>
<applicationListeners>
<listener class="com.github.izhangzhihao.rainbow.brackets.listener.RainbowColorsSchemeListener" topic="com.intellij.openapi.editor.colors.EditorColorsListener"/>
</applicationListeners>
<actions>
<action class="com.github.izhangzhihao.rainbow.brackets.action.ScopeHighlightingAction"
id="Rainbow.ScopeHighlightingAction"
text="Highlight Current Scope"
description="Highlight current scope.">
<mouse-shortcut keymap="$default" keystroke="control button3"/>
<mouse-shortcut keymap="Mac OS X" keystroke="meta button3"/>
<mouse-shortcut keymap="Mac OS X 10.5+" keystroke="meta button3"/>
</action>
<action class="com.github.izhangzhihao.rainbow.brackets.action.ScopeOutsideHighlightingRestrainAction"
id="Rainbow.ScopeOutsideHighlightingRestrainAction"
text="Restrain Scope Highlighting"
description="Restrain outside of current scope highlighting.">
<mouse-shortcut keymap="$default" keystroke="alt button3"/>
<mouse-shortcut keymap="Mac OS X" keystroke="alt button3"/>
<mouse-shortcut keymap="Mac OS X 10.5+" keystroke="alt button3"/>
</action>
</actions>
</idea-plugin>

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -1,6 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="Shell Script"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.SHBracePairProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -1,6 +1,6 @@
<idea-plugin>
<extensions defaultExtensionNs="izhangzhihao.rainbow.brackets">
<extensions defaultExtensionNs="com.chylex.intellij.rainbowbrackets">
<bracePairProvider language="SQL"
implementationClass="com.github.izhangzhihao.rainbow.brackets.provider.SqlBracePairProvider"/>
</extensions>
</idea-plugin>
</idea-plugin>

View File

@@ -4,8 +4,11 @@ import com.intellij.psi.PsiDocumentManager
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import com.jetbrains.lang.dart.DartFileType
import io.kotest.matchers.shouldBe
import org.junit.Test
class RainbowDartTest : LightJavaCodeInsightFixtureTestCase() {
@Test
fun testRainbowForDart() {
val code =
"""
@@ -50,4 +53,4 @@ void main() {
)
)
}
}
}

View File

@@ -5,9 +5,11 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import org.intellij.lang.annotations.Language
import org.jetbrains.plugins.groovy.GroovyFileType
import org.junit.Test
class RainbowGroovyTest : LightJavaCodeInsightFixtureTestCase() {
@Test
fun testRainbowForGroovy() {
@Language("Groovy") val code =
"""
@@ -57,4 +59,4 @@ Map<String, Map<String, String>> convertObjectsToMapProperties(Map<String, Objec
)
)
}
}
}

View File

@@ -9,13 +9,16 @@ import com.intellij.psi.PsiDocumentManager
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import org.intellij.lang.annotations.Language
import org.junit.Test
class RainbowJavaScriptTest : LightJavaCodeInsightFixtureTestCase() {
@Test
fun testJavaScriptPluginEnabled() {
assertTrue(PluginManagerCore.getPlugin(PluginId.getId("JavaScript"))?.isEnabled!!)
}
@Test
fun testIssue11() {
@Language("JavaScript") val code = """
"use strict";
@@ -41,6 +44,7 @@ const moment = require('moment')
)
}
@Test
fun testIssue12() {
@Language("JavaScript") val code = """
"use strict";
@@ -64,6 +68,7 @@ console.log(a == b)
)
}
@Test
fun testIssue21() {
@Language("JavaScript") val code = "open (\$" + "{f})\n" + "open (\$" + "{f} )"
@@ -85,6 +90,7 @@ console.log(a == b)
)
}
@Test
fun testIssue23() {
@Language("JavaScript") val code = """
"use strict";
@@ -131,6 +137,7 @@ if ((a.field_detail && a.is) ||
)
}
@Test
fun testIssue38() {
@Language("JavaScript") val code = """
const element = ( <div> <h1>Hello, world!</h1> </div> );
@@ -162,6 +169,7 @@ const element = ( <div> <h1>Hello, world!</h1> </div> );
)
}
@Test
fun `for somehow, it just don't work "testIssue39"`() {
@Language("JavaScript") val code = """
const html = '<div><div><div>Hello</div></div></div>'
@@ -193,6 +201,7 @@ const element = ( <div> <h1>Hello, world!</h1> </div> );
)
}
@Test
fun testIssue31() {
@Language("JavaScript") val code = """
"use strict";
@@ -223,6 +232,7 @@ const element = ( <div> <h1>Hello, world!</h1> </div> );
)
}
@Test
fun testIssue427() {
@Language("TypeScript") val code = """let example: Array<Map<string,string>>;""".trimIndent()
@@ -244,4 +254,4 @@ const element = ( <div> <h1>Hello, world!</h1> </div> );
)
}
}
}

View File

@@ -6,6 +6,7 @@ import com.intellij.psi.PsiDocumentManager
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import org.intellij.lang.annotations.Language
import org.junit.Test
class RainbowJavaTest : LightJavaCodeInsightFixtureTestCase() {
override fun tearDown() {
@@ -22,6 +23,7 @@ class RainbowJavaTest : LightJavaCodeInsightFixtureTestCase() {
rainbowSettings.languageBlacklist = setOf()
}
@Test
fun testRainbowForJava() {
@Language("Java") val code =
"""
@@ -60,6 +62,7 @@ public class Test<T> {
)
}
@Test
fun testDisableRainbowForJava() {
val rainbowSettings = RainbowSettings.instance
rainbowSettings.isRainbowEnabled = false
@@ -83,6 +86,7 @@ public class Test<T> {
)
}
@Test
fun testDisableRainbowAngleBracketsForJava() {
val rainbowSettings = RainbowSettings.instance
rainbowSettings.isEnableRainbowAngleBrackets = false
@@ -121,6 +125,7 @@ public class Test<T> {
)
}
@Test
fun testDisableRainbowRoundBracketsForJava() {
val rainbowSettings = RainbowSettings.instance
rainbowSettings.isEnableRainbowRoundBrackets = false
@@ -151,6 +156,7 @@ public class Test<T> {
)
}
@Test
fun testDisableRainbowSquigglyBracketsForJava() {
val rainbowSettings = RainbowSettings.instance
rainbowSettings.isEnableRainbowSquigglyBrackets = false
@@ -187,6 +193,7 @@ public class Test<T> {
)
}
@Test
fun testDoNOTRainbowifyBracketsWithoutContentForJava() {
val rainbowSettings = RainbowSettings.instance
rainbowSettings.isDoNOTRainbowifyBracketsWithoutContent = true
@@ -223,6 +230,7 @@ public class Test<T> {
)
}
@Test
fun testDoNOTRainbowifyBracketsWhenJavaInBlacklist() {
val rainbowSettings = RainbowSettings.instance
rainbowSettings.isDoNOTRainbowifyBracketsWithoutContent = true
@@ -246,6 +254,7 @@ public class Test<T> {
.shouldBe(0)
}
@Test
fun testIssue391() {
val rainbowSettings = RainbowSettings.instance
rainbowSettings.cycleCountOnAllBrackets = true
@@ -289,4 +298,4 @@ public class Test {
)
)
}
}
}

View File

@@ -5,8 +5,11 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import org.intellij.lang.annotations.Language
import org.jetbrains.kotlin.idea.KotlinFileType
import org.junit.Test
class RainbowKotlinTest : LightJavaCodeInsightFixtureTestCase() {
@Test
fun testRainbowForKotlin() {
@Language("kotlin") val code =
"""
@@ -64,6 +67,7 @@ fun <T> filter(l: List<T>, f: (T) -> Boolean): MutableList<T> {
)
}
@Test
fun testRainbowArrowForKotlin() {
@Language("kotlin") val code =
"""
@@ -125,6 +129,7 @@ val a: (Int) -> Unit = { aa ->
)
}
@Test
fun `ForSomeHowTheTestNotPassed "testRainbowLabelForKotlin"`() {
@Language("kotlin") val code =
"""
@@ -160,6 +165,7 @@ class AA {
)
}
@Test
fun testKotlinFunctionLiteralBracesAndArrow() {
@Language("kotlin") val code =
"""
@@ -191,4 +197,4 @@ fun t() {
)
)
}
}
}

View File

@@ -4,8 +4,11 @@ import com.intellij.psi.PsiDocumentManager
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import com.jetbrains.php.lang.PhpFileType
import io.kotest.matchers.shouldBe
import org.junit.Test
class RainbowPHPTest : LightJavaCodeInsightFixtureTestCase() {
@Test
fun testRainbowForPHP() {
val code =
"""
@@ -52,4 +55,4 @@ function padZero(string data): string
)
)
}
}
}

Some files were not shown because too many files have changed in this diff Show More