mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-18 22:52:37 +00:00
Refactor property key highlighting logic
This commit is contained in:
@@ -67,19 +67,15 @@ public class PropertiesHighlightingDefinition : DarkHighlightingDefinition
|
||||
{
|
||||
var text = CurrentContext.Document.GetText(line);
|
||||
|
||||
if (!text.TrimStart().StartsWith("#"))
|
||||
{
|
||||
int idx = text.IndexOf('=');
|
||||
if (text.TrimStart().StartsWith("#"))
|
||||
return;
|
||||
|
||||
if (idx > 0)
|
||||
{
|
||||
ChangeLinePart(
|
||||
line.Offset,
|
||||
line.Offset + idx,
|
||||
el => el.TextRunProperties.SetForegroundBrush("#3F9CD6".ToBrush())
|
||||
);
|
||||
}
|
||||
}
|
||||
int idx = text.IndexOf('=');
|
||||
|
||||
if (idx <= 0)
|
||||
return;
|
||||
|
||||
ChangeLinePart(line.Offset, line.Offset + idx, el => el.TextRunProperties.SetForegroundBrush("#3F9CD6".ToBrush()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -68,19 +68,15 @@ public class PropertiesHighlightingDefinition : LightHighlightingDefinition
|
||||
{
|
||||
var text = CurrentContext.Document.GetText(line);
|
||||
|
||||
if (!text.TrimStart().StartsWith("#"))
|
||||
{
|
||||
int idx = text.IndexOf('=');
|
||||
if (text.TrimStart().StartsWith("#"))
|
||||
return;
|
||||
|
||||
if (idx > 0)
|
||||
{
|
||||
ChangeLinePart(
|
||||
line.Offset,
|
||||
line.Offset + idx,
|
||||
el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush())
|
||||
);
|
||||
}
|
||||
}
|
||||
int idx = text.IndexOf('=');
|
||||
|
||||
if (idx <= 0)
|
||||
return;
|
||||
|
||||
ChangeLinePart(line.Offset, line.Offset + idx, el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user