Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js

Issue 1938313002: DevTools: [SASS] parse SCSS rules and their selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/gonzales/SCSSParser.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js b/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
index 07a53fe661973e056a3aa6f2e4be64d8917a7989..34d38ccd3f561a8fb47fae1ffe1bfd82504baf4f 100644
--- a/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
+++ b/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
@@ -61,16 +61,22 @@ WebInspector.SASSSupport.parseSCSS = function(url, content)
{
if (!event)
return new WebInspector.SASSSupport.AST(document, []);
- var data = /** @type {!{properties: !Array<!Object>, variables: !Array<!Object>, mixins: !Array<!Object>}} */(event.data);
- var properties = data.properties.map(createProperty);
- var variables = data.variables.map(createProperty);
- var mixins = data.mixins.map(createProperty);
- var rules = [
- new WebInspector.SASSSupport.Rule(document, "variables", WebInspector.TextRange.createFromLocation(0, 0), variables),
- new WebInspector.SASSSupport.Rule(document, "properties", WebInspector.TextRange.createFromLocation(0, 0), properties),
- new WebInspector.SASSSupport.Rule(document, "mixins", WebInspector.TextRange.createFromLocation(0, 0), mixins)
- ];
-
+ var data = /** @type {!Array<!Object>} */(event.data);
+ var rules = [];
+ for (var i = 0; i < data.length; ++i) {
+ var rulePayload = data[i];
+ var selectorText = "";
+ if (rulePayload.selectors.length) {
+ var first = rulePayload.selectors[0];
+ var last = rulePayload.selectors.peekLast();
+ var selectorRange = new WebInspector.TextRange(first.startLine, first.startColumn, last.endLine, last.endColumn);
+ selectorText = text.extract(selectorRange);
+ }
+ var properties = rulePayload.properties.map(createProperty);
+ var range = WebInspector.TextRange.fromObject(rulePayload.styleRange);
+ var rule = new WebInspector.SASSSupport.Rule(document, selectorText, range, properties);
+ rules.push(rule);
+ }
return new WebInspector.SASSSupport.AST(document, rules);
}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/gonzales/SCSSParser.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698