Skip to content

Commit

Permalink
add true/false/null constants
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Nov 25, 2018
1 parent 206671f commit 31cec85
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Syntaxes/SCSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ contexts:
pop: true
- match: ':'
scope: punctuation.separator.key-value.css
- match: '\b(false|true|null)\b'
scope: constant.language.scss
- include: property-values
- match: '\{'
scope: punctuation.section.property-list.begin.scss
Expand Down Expand Up @@ -1080,6 +1082,8 @@ contexts:
- include: scss-functions
- include: scss-operators
- include: scss-interpolation
- match: '\b(false|true|null)\b'
scope: constant.language.scss
- include: literal-string
- include: unquoted-string

Expand Down
4 changes: 4 additions & 0 deletions Syntaxes/Sass.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,8 @@ contexts:
pop: true
- match: ':'
scope: punctuation.separator.key-value.css
- match: '\b(false|true|null)\b'
scope: constant.language.sass
- include: property-values
- match: '((@)(include))\s+([\w-]+)'
captures:
Expand Down Expand Up @@ -1059,6 +1061,8 @@ contexts:
- include: scss-functions
- include: scss-operators
- include: scss-interpolation
- match: '\b(false|true|null)\b'
scope: constant.language.sass
- include: literal-string
- include: unquoted-string

Expand Down
18 changes: 15 additions & 3 deletions Tests/syntax_test_sass.sass
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,16 @@ input:not([type="radio"]):not(h1):not(custom-element):not(%placeholder), select,
*/

@mixin firefox-message($selector)
@mixin firefox-message($selector: false)
// <- punctuation.definition.keyword.sass
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration.sass
// ^ keyword.control.at-rule.sass
// ^^^^^^^^^^^^^^^ entity.name.function.sass
// ^ meta.function.parameters.sass punctuation.definition.group.begin.sass
// ^ meta.function.parameters.sass punctuation.definition.group.end.sass
// ^^ meta.function.parameters.sass variable.parameter.sass
// ^ punctuation.definition.variable.sass
// ^ constant.language
// ^ meta.function.parameters.sass punctuation.definition.group.end.sass
body.firefox #{$selector}:before
// ^^^^^^^^^^^^ meta.group.interpolation.sass
// ^ punctuation.definition.variable.sass
Expand Down Expand Up @@ -351,6 +351,7 @@ $map: (
+cm('png icons')
+ic
@if (global-variable-exists(spritesheet-sprites))
// ^ - keyword.operator
@each $sprite in $spritesheet-sprites
.ic--#{nth($sprite, 10)}
&:before
Expand All @@ -359,6 +360,17 @@ $map: (
fill: transparent


@if 1 + 1 == 2
//^ keyword.control.flow.conditional.sass
// ^ meta.at-rule constant.numeric.css
// ^ keyword.operator.sass
// ^ constant.numeric.css
border: 1px solid
@if $scope == ie9
// ^ - constant.numeric
@if null
// ^ constant.language
/*
Operators
Expand Down
12 changes: 8 additions & 4 deletions Tests/syntax_test_scss.scss
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,18 @@ Support property values after a line break?
http://sass-lang.com/documentation/file.SASS_REFERENCE.html#mixin-arguments
*/

@mixin sexy-border($color, $width: 1in) {
@mixin sexy-border($color: false, $width: 1in) {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration
// ^^^^^^^^^^^ entity.name.function
// ^^^^^^^^^^^^^^^^^^^ meta.function.parameters
// ^^^^^^ variable.parameter
// ^ punctuation.definition.variable
// ^ punctuation.separator
// ^ punctuation.separator.key-value
// ^^^ constant.numeric
// ^^ keyword.other.unit
// ^ constant.language
// ^ punctuation.separator
// ^ punctuation.separator.key-value
// ^^^ constant.numeric
// ^^ keyword.other.unit
@content;
// ^^^^^^^^ keyword.control.at-rule.content
// ^ punctuation.definition.keyword
Expand Down Expand Up @@ -500,6 +502,8 @@ $gutter-width: 10px;
// ^ punctuation.section.property-list.begin.css
@if $scope == ie9 { border: 1px solid; }
// ^ - constant.numeric
@if null { border: 3px double; }
// ^ constant.language
@mixin adjust-location($x, $y) {
@if unitless($x) {
// ^^^^^^^^^^^^ meta.function-call.scss
Expand Down

0 comments on commit 31cec85

Please sign in to comment.