Skip to content

Commit 30c5ea5

Browse files
SCSS: Updated color tagger to work on SCSS vars
1 parent de82d19 commit 30c5ea5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

EditorExtensions/CSS/Adornments/ColorTagger.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Drawing;
44
using System.Linq;
55
using System.Windows.Threading;
6+
using Microsoft.Css.Extensions;
67
using Microsoft.CSS.Core;
78
using Microsoft.CSS.Editor;
89
using Microsoft.CSS.Editor.Intellisense;
@@ -46,7 +47,7 @@ public IEnumerable<ITagSpan<ColorTag>> GetTags(NormalizedSnapshotSpanCollection
4647
private static IEnumerable<ParseItem> GetColors(CssTree tree, SnapshotSpan span)
4748
{
4849
ParseItem complexItem = tree.StyleSheet.ItemFromRange(span.Start, span.Length);
49-
if (complexItem == null || (!(complexItem is AtDirective) && !(complexItem is RuleBlock) && !(complexItem is LessVariableDeclaration) && !(complexItem is FunctionArgument)))
50+
if (complexItem == null || (!(complexItem is AtDirective) && !(complexItem is RuleBlock) && !(complexItem is CssVariableDeclaration) && !(complexItem is FunctionArgument)))
5051
return Enumerable.Empty<ParseItem>();
5152

5253
var colorCrawler = new CssItemAggregator<ParseItem>(filter: e => e.AfterEnd > span.Start && e.Start < span.End)
@@ -55,7 +56,7 @@ private static IEnumerable<ParseItem> GetColors(CssTree tree, SnapshotSpan span)
5556
(FunctionColor c) => c,
5657
(TokenItem i) => (i.PreviousSibling == null || (i.PreviousSibling.Text != "@" && i.PreviousSibling.Text != "$")) // Ignore variable names that happen to be colors
5758
&& i.TokenType == CssTokenType.Identifier
58-
&& (i.FindType<Declaration>() != null || i.FindType<LessExpression>() != null) // Ignore classnames that happen to be colors
59+
&& (i.FindType<Declaration>() != null || i.FindType<CssExpression>() != null) // Ignore classnames that happen to be colors
5960
&& Color.FromName(i.Text).IsNamedColor
6061
? i : null
6162
};

0 commit comments

Comments
 (0)