Skip to content

Commit

Permalink
Exclude semicolons and comments from spans
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Jan 2, 2025
1 parent f093d6a commit efb0d4d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/src/parse/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,9 @@ abstract class StylesheetParser extends Parser {
DebugRule _debugRule(LineScannerState start) {
whitespace(allowNewlines: true);
var value = _expression();
var expressionEnd = scanner.state;
expectStatementSeparator("@debug rule");
return DebugRule(value, scanner.spanFrom(start));
return DebugRule(value, scanner.spanFrom(start, expressionEnd));
}

/// Consumes an `@each` rule.
Expand Down Expand Up @@ -843,8 +844,9 @@ abstract class StylesheetParser extends Parser {
ErrorRule _errorRule(LineScannerState start) {
whitespace(allowNewlines: true);
var value = _expression();
var expressionEnd = scanner.state;
expectStatementSeparator("@error rule");
return ErrorRule(value, scanner.spanFrom(start));
return ErrorRule(value, scanner.spanFrom(start, expressionEnd));
}

/// Consumes an `@extend` rule.
Expand Down Expand Up @@ -1572,8 +1574,9 @@ abstract class StylesheetParser extends Parser {
WarnRule _warnRule(LineScannerState start) {
whitespace(allowNewlines: true);
var value = _expression();
var expressionEnd = scanner.state;
expectStatementSeparator("@warn rule");
return WarnRule(value, scanner.spanFrom(start));
return WarnRule(value, scanner.spanFrom(start, expressionEnd));
}

/// Consumes a `@while` rule.
Expand Down

0 comments on commit efb0d4d

Please sign in to comment.