Skip to content

Incorrect line numbers for errors outside blocks #3147

@GCorbel

Description

@GCorbel

When an error is made outside a block, the line number in the error is incorrect.

input.scss

.my-class {
  text-align: left;
  color: red;
}
.something-wrong-at-line-5 }

Actual results

The error is marked on line 4.
libsass 3.6.4

Error: Invalid CSS after "}": expected 1 selector or at-rule, was ".something-wrong-at"
        on line 4:2 of ../../../tmp/test.scss
>> }

   -^

Expected result

The error is correctly set on line 4 with Ruby Sass.
ruby sass 3.7.4

Error: Invalid CSS after "...rong-at-line-5 ": expected "{", was "}"
        on line 5 of /tmp/test.scss

The error is correctly set on line 4 with Dart Sass.
dart-sass 1.32.8 compiled with dart2js 2.10.5
version info:

Error: expected "{".
  ╷
5 │ .something-wrong-at-line-5 }
  │                            ^
  ╵
  /tmp/test.scss 5:28  root stylesheet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions