SublimeText / Sass

Sass and SCSS syntax for Sublime Text
https://packagecontrol.io/packages/Sass
MIT License
51 stars 8 forks source link

Default values inside var() function #43

Closed sandrojohanides closed 5 years ago

sandrojohanides commented 5 years ago

calc() doesn’t seem to matter in this case, values such as 0 or 0em are not of correct color.

screen shot 2018-11-26 at 13 01 33

padding-left: calc(
    var(--depth, 0) * #{$folder-list-padding} +
    var(--not-checkable, #{$folder-list-padding}) +
    var(--padding-left, 0em)
);
sandrojohanides commented 5 years ago

@braver There seems to be a regression here and it now looks exactly the same as the screenshot.

Edit, also this happened: screen shot 2018-12-07 at 10 54 24

.test {
  transform: rotate(0);
}

I would expect it to be red. screen shot 2018-12-07 at 10 56 15

braver commented 5 years ago

The CSS syntax will also not highlight the 0. For the 0 the deg unit is optional according to MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/angle. I'll open a PR for the CSS package and fix it here.

sandrojohanides commented 5 years ago

That might be not related to the original regression tho, where even 0em is blue.

braver commented 5 years ago

Oh, damn, sorry. I guess I didn't have good tests for this. The CSS syntax doesn't support defaults for var() and I copied their stuff back in when I was refactoring.

braver commented 5 years ago

Ok, I had a closer look. Default values are "declaration values", ie. they can be anything, and what they are will only be evaluated runtime. I'm not 100% sure what to do here, but I'll propose something for the CSS package and will follow whatever happens there.

braver commented 5 years ago

Please follow https://github.com/sublimehq/Packages/issues/1797 for this. If any conclusion is reached there, Sass will follow.

sandrojohanides commented 5 years ago

Thank you!