Skip to content

Commit

Permalink
[CSS] Fix custom property definitions (#4052)
Browse files Browse the repository at this point in the history
This commit fixes custom property definitions with declaration-list values.

Custom properties...
1. can take all sorts of values.
2. never start a selector.

Without this commit, leading `--` is ignored and custom property name being
consumed as html tag, starting a selector.
  • Loading branch information
deathaxe authored Oct 3, 2024
1 parent 40d0459 commit 9a8d068
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CSS/CSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,7 @@ contexts:
###[ PROPERTY IDENTIFIERS ]####################################################

properties-or-selectors:
- include: custom-properties
- match: '{{property_or_selector_begin}}'
branch_point: property-or-selector
branch:
Expand Down
15 changes: 15 additions & 0 deletions CSS/syntax_test_css.css
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,21 @@
}

.test-var-functions {
--custom-theme: { color: white; };
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.property-list.css meta.block.css */
/* ^^^^^^^^^^^^^^ meta.property-name.css entity.other.custom-property.css */
/* ^ punctuation.separator.key-value.css */
/* ^ meta.property-value.css */
/* ^^^^^^^^^^^^^^^^^ meta.property-list.css meta.block.css */
/* ^ punctuation.section.block.begin.css */
/* ^^^^^ meta.property-name.css support.type.property-name.css */
/* ^ punctuation.separator.key-value.css */
/* ^^^^^^ meta.property-value.css */
/* ^^^^^ support.constant.color.w3c.standard.css */
/* ^ punctuation.terminator.rule.css */
/* ^ punctuation.section.block.end.css */
/* ^ punctuation.terminator.rule.css */

--test-var: arial;
/* ^^^^^^^^^^ entity.other.custom-property.css */
/* ^ punctuation.separator.key-value.css*/
Expand Down

0 comments on commit 9a8d068

Please sign in to comment.