Closed Subash closed 8 months ago
This is intentional. Per the spec, warnings for @warn
only include a stack trace, not a span. This is for a combination of two reasons:
@warn
, it's generally expected to be displayed to the user as an indication of a place the stylesheet is doing something it shouldn't (such as $foo && $bar
).@warn
rule is usually called from a function or a mixin, or possibly a nested series of functions or mixins. This means that the @warn
rule itself is not usually the place where the user's stylesheet is doing something wrong, and so isn't useful to show in a span.
I am using the
sass.compile
API with a custom logger, and it seems thatFileSpan
is not provided when using the@warn
statement. I also checked with the@debug
statement, and it appears thatFileSpan
is provided when the@debug
statement is used with a custom logger.I explored the source code for both statements and found some differences, but I couldn't figure out an elegant way to include
FileSpan
when callingwarn
.Link to the source for
@warn
Link to the source for@debug
Here is a script to reproduce the issue.