stylus-supremacy icon indicating copy to clipboard operation
stylus-supremacy copied to clipboard

parenthesis get added to calculus

Open Cactusbone opened this issue 4 years ago • 2 comments

Using command line and options:

    "stylusSupremacy.insertSpaceInsideParenthesis": false,
    "stylusSupremacy.insertParenthesisAfterNegation": false,
    "stylusSupremacy.insertParenthesisAroundIfCondition": false,

I'm not expecting parenthesis to be added :

  • barBorderRadius = colorBarHeight / 2 to barBorderRadius = (colorBarHeight / 2)
  • width 'calc(%s - 20px)' % floor(100%/n) => width "calc(%s - 20px)" % floor((100% / n))
  • width calc(100% / 3) => width calc((100% / 3)) unfortunately this ends up in the final css too, increasing its size

Cactusbone avatar Oct 08 '19 16:10 Cactusbone

Thanks for reporting this.

Dealing with parentheses is always a hassle because there is no explicit representation of a parenthesis in Stylus AST generated by Stylus compiler (only nested Expression objects).

I do have a plan to refactor the formatter so it will handle this better, but no ETA though. Please bear with me.

ThisIsManta avatar May 06 '20 10:05 ThisIsManta

+1 to this :)

Note that if you minify your CSS before shipping it, the extra parentheses are harmless

aleclarson avatar Oct 26 '21 02:10 aleclarson