Skip to content

Commit

Permalink
fix #45 bem selectors with interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Feb 25, 2024
1 parent 98bb8d2 commit d2a09b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Syntaxes/SCSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ contexts:
push: selector-class-identifier

scss-bem-selector:
- match: (\&)([-_]+{{ident}})
- match: (\&)([-_]+({{ident}}|(?=#{)))
# &--bem_ish selectors
captures:
1: variable.language.parent.css
Expand Down
13 changes: 13 additions & 0 deletions Tests/syntax_test_scss.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1381,3 +1381,16 @@ $color2 : #f00;
// ^^^^ meta.declaration.identifier.scss
$color3 : #f00;
// ^^^^ meta.declaration.identifier.scss

//=============================================================================
// Bem-ish selectors with interpolation
// https://github.com/braver/Sass/issues/45
//=============================================================================
&--test {}
//^^^^^ meta.selector.css entity.other.attribute-name.css
&--#{$test} {}
//^ meta.selector.css entity.other.attribute-name.css
.test & {}
// ^ meta.selector.css variable.language.parent.css
.test:not() & {}
// ^ meta.selector.css variable.language.parent.css

0 comments on commit d2a09b5

Please sign in to comment.