Skip to content

Commit

Permalink
correct scopes for attribute+pseudo
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Sep 18, 2018
1 parent 1d320f4 commit 3605a85
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
55 changes: 33 additions & 22 deletions LESS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -173,28 +173,39 @@ contexts:
- include: pseudo-elements
- include: pseudo-classes
- include: selector
- match: '\['
scope: punctuation.definition.entity.css
push:
- meta_scope: meta.attribute-selector.css
- include: qualified-name
- match: '({{ident}})'
scope: entity.other.attribute-name.css
- match: '\s*([~*|^$]?=)\s*'
captures:
1: keyword.operator.attribute-selector.css
push:
- match: '[^\s\]\[''"]'
scope: string.unquoted.css
- include: literal-string
- match: '(?=(\s|\]))'
pop: true
- match: '(?:\s+([iI]))?' # case insensitive flag
captures:
1: keyword.other.css
- match: '\]'
scope: punctuation.definition.entity.css
pop: true
- match: '(?=\[)'
push:
- meta_scope: meta.selector.css
- match: \s*(?=$)
pop: true
- match: '(?=[{)])'
pop: true
- match: '\['
scope: punctuation.definition.entity.css
push:
- meta_scope: meta.attribute-selector.css
- include: qualified-name
- match: '({{ident}})'
scope: entity.other.attribute-name.css
- match: '\s*([~*|^$]?=)\s*'
captures:
1: keyword.operator.attribute-selector.css
push:
- match: '[^\s\]\[''"]'
scope: string.unquoted.css
- include: literal-string
- match: '(?=(\s|\]))'
pop: true
- match: '(?:\s+([iI]))?' # case insensitive flag
captures:
1: keyword.other.css
- match: '\]'
scope: punctuation.definition.entity.css
pop: true
- include: less-interpolation
- include: pseudo-elements
- include: pseudo-classes
- include: selector
- include: less-operators


Expand Down
13 changes: 13 additions & 0 deletions syntax_test_less.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
background-color: pink;
// ^^^^^^^^^^^^^^^ meta.property-name.css
// ^^^^^ meta.property-value.css
&-bemish { }
//^ keyword.operator.ampersand.less
// ^^^^^^^ entity.other.attribute-name.css
// ^^^^^^^^ meta.selector.css
[data-type="text"]:hover,
//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.selector
// ^^^^^^ entity.other.pseudo-class.css
// ^ punctuation.definition.entity.css
// ^ punctuation.separator.css
[data-type="text"]:active {}
//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.selector
// ^^^^^^^ entity.other.pseudo-class.css
// ^ punctuation.definition.entity.css

#id@{interopol}
background: bla
Expand Down

0 comments on commit 3605a85

Please sign in to comment.