Skip to content

Commit

Permalink
fix(core): resolve compatibility issues with editor highlighter service
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 29, 2024
1 parent 6124799 commit 175e6c9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/main/kotlin/com/phodal/shirecore/ui/RightPanelView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.DataProvider
import com.intellij.openapi.actionSystem.ex.ActionUtil
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ReadAction
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.*
import com.intellij.openapi.editor.colors.EditorColorsListener
import com.intellij.openapi.editor.colors.EditorColorsManager
Expand All @@ -28,15 +30,16 @@ import com.intellij.util.concurrency.annotations.RequiresReadLock
import com.intellij.util.messages.Topic
import com.intellij.util.ui.JBUI
import com.phodal.shirecore.utils.markdown.CodeFence
import java.util.concurrent.atomic.AtomicBoolean
import java.awt.BorderLayout
import java.util.concurrent.atomic.AtomicBoolean
import javax.swing.JComponent

class RightPanelView(
project: Project,
text: String,
) : JBPanel<RightPanelView>(BorderLayout()), DataProvider, Disposable {
private var editor: EditorEx = createCodeViewerEditor(project, text, this)

init {
setupActionForEditor(project)

Expand Down Expand Up @@ -113,7 +116,10 @@ class RightPanelView(

editor.setFile(file)
editor.setCaretEnabled(true)
val highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(project, file)

val highlighter = ApplicationManager.getApplication()
.service<EditorHighlighterFactory>()
.createEditorHighlighter(project, file)

editor.highlighter = highlighter

Expand Down

0 comments on commit 175e6c9

Please sign in to comment.