Refactor property key highlighting logic
Some checks are pending
MSBuild / build (push) Waiting to run
MSBuild / publish (push) Blocked by required conditions

This commit is contained in:
ema
2025-06-29 06:36:05 +08:00
parent 9d42da53c0
commit caf301f3f5
2 changed files with 16 additions and 24 deletions

View File

@@ -67,19 +67,15 @@ public class PropertiesHighlightingDefinition : DarkHighlightingDefinition
{ {
var text = CurrentContext.Document.GetText(line); var text = CurrentContext.Document.GetText(line);
if (!text.TrimStart().StartsWith("#")) if (text.TrimStart().StartsWith("#"))
{ return;
int idx = text.IndexOf('='); int idx = text.IndexOf('=');
if (idx > 0) if (idx <= 0)
{ return;
ChangeLinePart(
line.Offset, ChangeLinePart(line.Offset, line.Offset + idx, el => el.TextRunProperties.SetForegroundBrush("#3F9CD6".ToBrush()));
line.Offset + idx,
el => el.TextRunProperties.SetForegroundBrush("#3F9CD6".ToBrush())
);
}
}
} }
} }
} }

View File

@@ -68,19 +68,15 @@ public class PropertiesHighlightingDefinition : LightHighlightingDefinition
{ {
var text = CurrentContext.Document.GetText(line); var text = CurrentContext.Document.GetText(line);
if (!text.TrimStart().StartsWith("#")) if (text.TrimStart().StartsWith("#"))
{ return;
int idx = text.IndexOf('='); int idx = text.IndexOf('=');
if (idx > 0) if (idx <= 0)
{ return;
ChangeLinePart(
line.Offset, ChangeLinePart(line.Offset, line.Offset + idx, el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush()));
line.Offset + idx,
el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush())
);
}
}
} }
} }
} }