New syntax highlighting doesn't work with git "staging area" enabled
Gerrit-K opened this issue ยท 11 comments
I really loved to read about the new syntax highlighting and other language-related features, but it seems that it doesn't work when the git "staging area" is enabled (Preferences > Version Control > Git > Enable staging area). Turning it off and on turns the highlighting on an off accordingly. I hope this is not a bug in the IDE itself, though ...
Hey! TBH with you I didn't even know IDEA had a staging area now ๐ will look into it tonight but I think it's solvable.
Does it cause exceptions or other visible issues?
Hehe, thanks for looking into it :) I think it dropped in the 2021 version, but wasn't promoted so much. But for someone like me, who likes to switch between the IDE and the command line to perform git actions, it's quite useful. Plus: it allows you to selectively stage hunks and lines and directly edit the staged content (where "stage" is meant in the real git context, i.e. the index).
But back to topic, no, I didn't see any errors, exceptions or other visible issues. The (standard) completions also works fine for both settings, as far as I can tell. It's just not highlighted.
The staging area is well hidden in code. Tricky. I could override the EditorTextFieldProvider, but that is used by the entire IDE.
Another prototype that may work, but that's madness
project.messageBus.connect().also {
...
it.subscribe(ToolWindowManagerListener.TOPIC, object : ToolWindowManagerListener {
override fun toolWindowShown(toolWindow: ToolWindow) {
if (toolWindow.id == "Commit") {
val contentManager = toolWindow.contentManager
contentManager.addContentManagerListener(object : ContentManagerListener {
override fun contentAdded(event: ContentManagerEvent) {
val content = event.content
content.addPropertyChangeListener { e ->
if (e.propertyName == Content.PROP_COMPONENT) {
if (e.newValue != null && e.newValue::class.java.simpleName == "GitStagePanel") {
// Get and cache the EditorTextField
}
}
}
}
})
}
}
})
}
I'll just override EditorTextFieldProvider
. I've weighted the alternatives, and that's the best one.
I don't think I'll be able to deliver 0.21.1 before the next two weeks unfortunately.
Hey @lppedd , sorry for the late reply. Don't worry about that :) It's not urgent at all, but I highly appreciate your fast response and commitment! Looking forward to the next release, whenever it will drop :)
Now the Conventional Commit language is always injected in the text editor.
When the "highlight syntax" option is disabled, the lexer simply returns normal text token types, so they won't be highlighted.