mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-19 07:04:51 +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);
|
var text = CurrentContext.Document.GetText(line);
|
||||||
|
|
||||||
if (!text.TrimStart().StartsWith("#"))
|
if (text.TrimStart().StartsWith("#"))
|
||||||
{
|
return;
|
||||||
int idx = text.IndexOf('=');
|
|
||||||
|
|
||||||
if (idx > 0)
|
int idx = text.IndexOf('=');
|
||||||
{
|
|
||||||
ChangeLinePart(
|
if (idx <= 0)
|
||||||
line.Offset,
|
return;
|
||||||
line.Offset + idx,
|
|
||||||
el => el.TextRunProperties.SetForegroundBrush("#3F9CD6".ToBrush())
|
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);
|
var text = CurrentContext.Document.GetText(line);
|
||||||
|
|
||||||
if (!text.TrimStart().StartsWith("#"))
|
if (text.TrimStart().StartsWith("#"))
|
||||||
{
|
return;
|
||||||
int idx = text.IndexOf('=');
|
|
||||||
|
|
||||||
if (idx > 0)
|
int idx = text.IndexOf('=');
|
||||||
{
|
|
||||||
ChangeLinePart(
|
if (idx <= 0)
|
||||||
line.Offset,
|
return;
|
||||||
line.Offset + idx,
|
|
||||||
el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush())
|
ChangeLinePart(line.Offset, line.Offset + idx, el => el.TextRunProperties.SetForegroundBrush(Colors.Blue.ToBrush()));
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user