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

Fix exception when opening certain diff editors

Closes 
This commit is contained in:
chylex 2024-12-09 12:42:22 +01:00
parent 48c8cc73b0
commit 93f5911faf
Signed by: chylex
SSH Key Fingerprint: SHA256:WqM8X/1DDn11LbYM0H5wsqZUjbcKxVsic37L+ERcF4o
2 changed files with 8 additions and 8 deletions
src/main/kotlin/com/chylex/intellij/coloredbrackets/indents

View File

@ -8,7 +8,6 @@ import com.intellij.ide.actions.ToggleZenModeAction
import com.intellij.lang.LanguageParserDefinitions
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.IndentGuideDescriptor
import com.intellij.openapi.editor.ex.EditorEx
import com.intellij.openapi.editor.ex.util.EditorUtil
import com.intellij.openapi.editor.markup.HighlighterTargetArea
import com.intellij.openapi.editor.markup.MarkupModel
@ -35,11 +34,9 @@ import java.util.Collections
* */
class RainbowIndentsPass internal constructor(
project: Project,
editor: Editor,
private val myEditor: Editor,
private val myFile: PsiFile,
) : TextEditorHighlightingPass(project, editor.document, false), DumbAware {
private val myEditor: EditorEx = editor as EditorEx
) : TextEditorHighlightingPass(project, myEditor.document, false), DumbAware {
@Volatile
private var myRanges = emptyList<TextRange>()

View File

@ -1,19 +1,22 @@
package com.chylex.intellij.coloredbrackets.indents
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.editor.impl.ImaginaryEditor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
class RainbowIndentsPassFactory :
TextEditorHighlightingPassFactoryRegistrar, TextEditorHighlightingPassFactory {
override fun createHighlightingPass(file: PsiFile, editor: Editor): TextEditorHighlightingPass {
return RainbowIndentsPass(file.project, editor, file)
override fun createHighlightingPass(file: PsiFile, editor: Editor): RainbowIndentsPass? {
return when (editor) {
is ImaginaryEditor -> null
else -> RainbowIndentsPass(file.project, editor, file)
}
}
override fun registerHighlightingPassFactory(registrar: TextEditorHighlightingPassRegistrar, project: Project) {