From 320439cfe3eb1d95421b341498a849e8926f411d Mon Sep 17 00:00:00 2001 From: Steve Ramage Date: Sun, 21 Jun 2026 12:55:38 -0700 Subject: [PATCH] fix: underline grammar-backed keys instead of recoloring them (#467) The key marker (GrammarEngineKeyAnnotator) tinted grammar-backed keys with a distinct color; having two key colors was too distracting, especially on light themes. Switch it to a plain underline so the key keeps its normal color and the grammar marker is subtle. Refs #467 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../annotators/GrammarEngineKeyAnnotator.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/annotators/GrammarEngineKeyAnnotator.kt b/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/annotators/GrammarEngineKeyAnnotator.kt index 4942a84..a184048 100644 --- a/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/annotators/GrammarEngineKeyAnnotator.kt +++ b/src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/annotators/GrammarEngineKeyAnnotator.kt @@ -3,9 +3,12 @@ package net.sjrx.intellij.plugins.systemdunitfiles.annotators import com.intellij.lang.annotation.AnnotationHolder import com.intellij.lang.annotation.Annotator import com.intellij.lang.annotation.HighlightSeverity -import com.intellij.openapi.editor.DefaultLanguageHighlighterColors import com.intellij.openapi.editor.colors.TextAttributesKey +import com.intellij.openapi.editor.markup.EffectType +import com.intellij.openapi.editor.markup.TextAttributes import com.intellij.psi.PsiElement +import com.intellij.ui.JBColor +import java.awt.Font import com.intellij.psi.util.PsiTreeUtil import net.sjrx.intellij.plugins.systemdunitfiles.psi.UnitFileProperty import net.sjrx.intellij.plugins.systemdunitfiles.psi.UnitFileSectionType @@ -40,10 +43,11 @@ class GrammarEngineKeyAnnotator : Annotator { } companion object { - // Layered on top of the normal key color; METADATA gives a distinct, theme-aware tint. + // Underline the key, keeping its normal color — recoloring grammar vs non-grammar keys with two + // different colors was too distracting, especially on light themes. val NEW_ENGINE_KEY: TextAttributesKey = TextAttributesKey.createTextAttributesKey( "SYSTEMD_UNIT_FILE_NEW_GRAMMAR_ENGINE_KEY", - DefaultLanguageHighlighterColors.METADATA, + TextAttributes(null, null, JBColor.GRAY, EffectType.LINE_UNDERSCORE, Font.PLAIN), ) } }