Skip primary for comment lines in properties files
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-27 22:49:28 +08:00
parent 12046220c1
commit e113030dce
2 changed files with 23 additions and 13 deletions

View File

@@ -66,14 +66,19 @@ public class PropertiesHighlightingDefinition : DarkHighlightingDefinition
protected override void ColorizeLine(DocumentLine line)
{
var text = CurrentContext.Document.GetText(line);
int idx = text.IndexOf('=');
if (idx > 0)
if (!text.TrimStart().StartsWith("#"))
{
ChangeLinePart(
line.Offset,
line.Offset + idx,
int idx = text.IndexOf('=');
if (idx > 0)
{
ChangeLinePart(
line.Offset,
line.Offset + idx,
el => el.TextRunProperties.SetForegroundBrush("#3F9CD6".ToBrush())
);
);
}
}
}
}

View File

@@ -67,14 +67,19 @@ public class PropertiesHighlightingDefinition : LightHighlightingDefinition
protected override void ColorizeLine(DocumentLine line)
{
var text = CurrentContext.Document.GetText(line);
int idx = text.IndexOf('=');
if (idx > 0)
if (!text.TrimStart().StartsWith("#"))
{
ChangeLinePart(
line.Offset,
line.Offset + idx,
el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush())
);
int idx = text.IndexOf('=');
if (idx > 0)
{
ChangeLinePart(
line.Offset,
line.Offset + idx,
el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush())
);
}
}
}
}