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

refactoring

This commit is contained in:
张志豪 2021-08-13 11:30:15 +08:00
parent b80a898619
commit 277495f165
2 changed files with 12 additions and 6 deletions
src/main/kotlin/com/github/izhangzhihao/rainbow/brackets/indents

View File

@ -24,6 +24,9 @@ import com.intellij.util.text.CharArrayUtil
import java.awt.Graphics
import java.awt.Graphics2D
/** From [com.intellij.codeInsight.daemon.impl.IndentGuideRenderer]
* Commit history : https://sourcegraph.com/github.com/JetBrains/intellij-community/-/blob/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/IndentGuideRenderer.java#tab=history
* */
class RainbowIndentGuideRenderer: CustomHighlighterRenderer {
override fun paint(editor: Editor, highlighter: RangeHighlighter, g: Graphics) {
if (editor !is EditorEx) return

View File

@ -30,7 +30,10 @@ import java.lang.StrictMath.abs
import java.lang.StrictMath.min
import java.util.*
/** From [com.intellij.codeInsight.daemon.impl.IndentsPass] */
/** 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
* mirror changes start from `Make it possible to ignore indent guides more granularly and do so for C#`
* */
class RainbowIndentsPass internal constructor(
project: Project,
editor: Editor,
@ -224,12 +227,12 @@ class RainbowIndentsPass internal constructor(
}
*/
private inner class IndentsCalculator internal constructor() {
internal val myComments: MutableMap<Language, TokenSet> = HashMap()
internal val lineIndents: IntArray // negative value means the line is empty (or contains a comment) and indent
private inner class IndentsCalculator() {
val myComments: MutableMap<Language, TokenSet> = HashMap()
val lineIndents: IntArray // negative value means the line is empty (or contains a comment) and indent
// (denoted by absolute value) was deduced from enclosing non-empty lines
internal val myChars: CharSequence
val myChars: CharSequence
init {
lineIndents = IntArray(document.lineCount)
@ -239,7 +242,7 @@ class RainbowIndentsPass internal constructor(
/**
* Calculates line indents for the [target document][.myDocument].
*/
internal fun calculate() {
fun calculate() {
val fileType = myFile.fileType
val tabSize = EditorUtil.getTabSize(myEditor)