sass / dart-sass

The reference implementation of Sass, written in Dart.
https://sass-lang.com/dart-sass
MIT License
3.97k stars 360 forks source link

Deprecation message replaces underscores with hyphens #2180

Closed mikeybinns closed 8 months ago

mikeybinns commented 8 months ago

For some reason, when I see a deprecation message, the recommendation it provides replaces the underscores with hyphens, which then breaks the code. I'm not sure if this happens with the automatic migrator as I'm not using it.

image

Steps to recreate:

  1. set up a sass file, add 2 variables with underscores in the name
  2. divide one variable by another
  3. compile the sass to see the message

The projects I've seen this on use Gulp and Gulp Sass, with this package passed into gulp-sass.

ntkme commented 8 months ago

Sass identifiers treat hyphens and underscores as identical. So, it should not break your code even if you apply it as is.

Technically, we can attempt to use source mapping to get the original input for variable name for recommendation, but it's only cosmetic.

mikeybinns commented 8 months ago

Well I've learned something today. I still think it's worth fixing. I would wager there's a large amount of people who don't know that, and so it would be a source of confusion if there were mixed hyphens or underscores for the same variable name, as many other languages treat them differently.

It may also break certain intellisense plugins such as this one for VS Code which has over 1 million downloads. I understand that this is technically a bug in that extension, but I think it should still be considered due to its popularity.

I also personally prefer underscores to hyphens simply because with underscores, you can double click to select the whole variable name, where as with hyphens, it will only select part of that name.