User-Style-Manager
User-Style-Manager copied to clipboard
Tracking bug for supporting custom coding styles
Custom coding styles should be supported, may be using some standard formats, or providing multiple options regarding various parts / aspects of coding.
I suppose, you have to invent some kind of internal syntax first. This will also be useful for fixing parser-related issues.
You have to analyze parts of the style first just to know what you work with:
/* - start of the commentary */ - end of the commentary { - start of the rule block } - end of the rule block ; - the symbol that divides sub-rules. May be omitted for the last sub-rule.
%caret%- symbolizes the caret.
%space%- symbolizes a single space character.
%tab%- symbolizes a 4 space characters.
%namespace%- symbolizes namespace rules.
%selector%- a single selector or multiple ones.
%rule%- a block inside "{" and "}".
%property%- a single property.
%value%- a single value or a group of ones.
%importance%- represents the importance of a sub-rule, may take one of 2 possible states: "!important" or none.
%imp_0%- "importance level 0", absence of the "!important;" after a value.
%imp_1%- "importance level 3", presence of "!important;" after a value.
%subrule%- one sub-rule, a set of "%property%:%value%%importance%
%first_subrule%- the first sub-rule in a %rule% block.
%last_subrule%- the last sub-rule in a %rule% block.
the 4 levels of importance can be just clubbed into 2, one with !important and other without.
having ; or not is a syntax issue, and ; should always be present, unless its the last line of a block.
Actually, as CSS Beautifier is already present in the code, and available, one time formatting wil lbe taken care by it. I will have to explore the customizations it can provide.
For live syntax validatoins, I can only provide a low level check, as it might become cpu consuming after certain limit of code.
the 4 levels of importance can be just clubbed into 2, one with !important and other without.
Agreed, updated.