├── .python-version
├── LICENSE
├── Preferences
├── Comments.tmPreferences
├── Fold.tmPreferences
├── Indexed Reference List.tmPreferences
├── Indexed Symbol List.tmPreferences
├── Symbol List - Functions.tmPreferences
├── Symbol List - Mixins.tmPreferences
├── Symbol List - Selector.tmPreferences
└── Symbol List - Variables.tmPreferences
├── README.md
├── Syntaxes
├── SCSS.sublime-settings
├── SCSS.sublime-syntax
├── Sass.sublime-settings
└── Sass.sublime-syntax
├── messages.json
├── messages
├── 3.0.0.txt
└── 4.0.0.txt
├── plugin.py
└── plugins
├── __init__.py
└── completions
├── __init__.py
├── common.py
├── function_args.py
├── properties.py
└── provider.py
/.python-version:
--------------------------------------------------------------------------------
1 | 3.8
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Koen Lageveen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Preferences/Comments.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 | source.sass, source.scss
6 | settings
7 |
8 | shellVariables
9 |
10 |
11 | name
12 | TM_COMMENT_START
13 | value
14 | //
15 |
16 |
17 | name
18 | TM_COMMENT_START_2
19 | value
20 | /*
21 |
22 |
23 | name
24 | TM_COMMENT_END_2
25 | value
26 | */
27 |
28 |
29 | name
30 | TM_COMMENT_DISABLE_INDENT
31 | value
32 | no
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Preferences/Fold.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 | source.scss
6 | settings
7 |
8 | foldScopes
9 |
10 |
11 | begin
12 | punctuation.definition.comment.begin
13 | end
14 | punctuation.definition.comment.end
15 | excludeTrailingNewlines
16 |
17 |
18 |
19 | begin
20 | punctuation.section.brackets.begin
21 | end
22 | punctuation.section.brackets.end
23 | excludeTrailingNewlines
24 |
25 |
26 |
27 | begin
28 | punctuation.section.block.begin
29 | end
30 | punctuation.section.block.end
31 | excludeTrailingNewlines
32 |
33 |
34 |
35 | begin
36 | punctuation.section.group.begin
37 | end
38 | punctuation.section.group.end
39 | excludeTrailingNewlines
40 |
41 |
42 |
43 | begin
44 | punctuation.section.interpolation.begin
45 | end
46 | punctuation.section.interpolation.end
47 | excludeTrailingNewlines
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Preferences/Indexed Reference List.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 |
6 | source.scss meta.at-rule.import meta.function-call.arguments entity.other.layer,
7 | source.scss variable.other - source.scss variable punctuation.definition.variable - meta.declaration.identifier
8 |
9 | settings
10 |
11 | showInIndexedReferenceList
12 | 1
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Preferences/Indexed Symbol List.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 |
6 | source.scss meta.declaration.identifier variable.other - source.scss variable punctuation.definition.variable,
7 | source.scss meta.function.parameters variable.parameter - source.scss variable punctuation.definition.variable,
8 | source.scss entity.name.mixin,
9 | source.scss entity.other.custom-property
10 |
11 | settings
12 |
13 | showInIndexedSymbolList
14 | 1
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Preferences/Symbol List - Functions.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 | source.scss entity.name.function
6 | settings
7 |
8 | showInSymbolList
9 | 1
10 | symbolTransformation
11 |
12 | s/^/@function /;
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Preferences/Symbol List - Mixins.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 | source.scss entity.name.mixin
6 | settings
7 |
8 | showInSymbolList
9 | 1
10 | symbolTransformation
11 |
12 | s/^/@mixin /;
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Preferences/Symbol List - Selector.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 | source.scss meta.selector
6 | settings
7 |
8 | showInSymbolList
9 | 1
10 | symbolTransformation
11 |
12 | s/\/\*.*?\*\///g; # remove block comments
13 | s/\s*\/\/[^\n]*\n//g; # remove line comments
14 | s/\s+([,;)\]}])/$1/g; # remove whitespace before punctuation
15 | s/([(\[{])\s+/$1/g; # remove whitespace after punctuation
16 | s/\s+/ /g; # remove multiple whitespace
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Preferences/Symbol List - Variables.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | scope
5 | source.scss meta.declaration.identifier variable.other
6 | settings
7 |
8 | showInSymbolList
9 | 1
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sass and SCSS
2 |
3 | [Sass](https://sass-lang.com) and [SCSS](https://sasscss.org) syntax definitions for [Sublime Text](https://www.sublimetext.com) based on its CSS syntax.
4 |
5 | Highlights `.sass` or `.scss` files, and provides
6 |
7 | - snippets
8 | - completions
9 | - symbols
10 |
11 | ## Installation
12 |
13 | ### Package Control
14 |
15 | The easiest way to install is using [Package Control](https://packagecontrol.io). It's listed as `Sass`.
16 |
17 | 1. Open `Command Palette` using ctrl+shift+P or menu item `Tools → Command Palette...`
18 | 2. Choose `Package Control: Install Package`
19 | 3. Find `Sass` and hit Enter
20 |
21 | ## Troubleshooting
22 |
23 | SCSS extends Sublime Text's CSS syntax definition as of ST4149.
24 |
25 | If SCSS syntax highlighting doesn't work and console displays syntax errors,
26 |
27 | 1. check if CSS package is enabled.
28 | 2. remove any out-dated syntax override.
29 |
30 | ### Enable CSS package
31 |
32 | 1. Open `Command Palette` using ctrl+shift+P or menu item `Tools → Command Palette...`
33 | 2. Choose `Package Control: Enable Packages`
34 | 3. Find `CSS` and hit Enter
35 |
36 | ### Remove overrides
37 |
38 | 1. call _Menu > Preferences > Browse Packages.._
39 | 2. Look for _CSS_ folder
40 | 3. Remove it or at least delete any _CSS.sublime-syntax_ in it
41 |
42 | ## Notes
43 |
44 | Development on the Sass syntax is currently frozen. It's too high maintenance since it's so different from CSS. Furthermore, the Sass language doesn't support various features that SCSS does: it's not left behind by the Sass team per se, but SCSS is the primary language right now.
45 | That being said, if you want to improve the Sass syntax, contributions are more than welcome.
46 |
--------------------------------------------------------------------------------
/Syntaxes/SCSS.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | // Set to true to disable default completions.
3 | "disable_default_completions": false,
4 |
5 | // Controls what scopes default completions will be provided in.
6 | // Can be a list of strings which are joined before matching.
7 | "default_completions_selector": "source.scss - source.scss comment - source.scss meta.embedded - source.scss source - source.scss text",
8 |
9 | // Default separators except `-`
10 | "word_separators": "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?",
11 |
12 | // Default separator and additional `-`
13 | "sub_word_separators": "_-",
14 | }
15 |
--------------------------------------------------------------------------------
/Syntaxes/SCSS.sublime-syntax:
--------------------------------------------------------------------------------
1 | %YAML 1.2
2 | ---
3 | # http://www.sublimetext.com/docs/3/syntax.html
4 | name: SCSS
5 | scope: source.scss
6 | version: 2
7 |
8 | extends: Packages/CSS/CSS.sublime-syntax
9 |
10 | file_extensions:
11 | - scss
12 |
13 | ###############################################################################
14 |
15 | variables:
16 |
17 | # CSS overrides
18 |
19 | ident_start: (?:{{nmstart}}|#{)
20 |
21 | property_or_selector_begin: (?={{ident_begin}}|{{selector_start}})
22 | property_end: (?=[;)}])
23 |
24 | selector_start: '[[:alpha:].:#%&*\[{{combinator_char}}]'
25 | selector_end: (?=[;{}])
26 |
27 | tag_name_begin: (?=[[:alpha:]]|#{)
28 |
29 | lang_range_begin: (?={{ident_start}}|\*)
30 | unquoted_url_begin: (?={{ident_start}}|/)
31 |
32 | # SCSS variables
33 |
34 | ###############################################################################
35 |
36 | contexts:
37 |
38 | main:
39 | - meta_include_prototype: false
40 | - match: ''
41 | set: [stylesheet, frontmatter]
42 |
43 | frontmatter:
44 | - meta_include_prototype: false
45 | - match: (---).*\n
46 | captures:
47 | 0: meta.frontmatter.jekyll
48 | 1: punctuation.section.frontmatter.begin.jekyll
49 | embed: scope:source.yaml
50 | embed_scope: meta.frontmatter.jekyll source.yaml.embedded.jekyll
51 | escape: ^(---)\s*\n
52 | escape_captures:
53 | 0: meta.frontmatter.jekyll
54 | 1: punctuation.section.frontmatter.end.jekyll
55 | pop: 1
56 | # Ensure to highlight frontmatter if the syntax is embedded, but pop as early as possible
57 | - match: ^|(?=\S)
58 | pop: 1
59 |
60 | ###[ CSS ]#####################################################################
61 |
62 | stylesheet:
63 | - include: comments
64 | - include: properties-or-selectors
65 | - include: property-lists
66 | - include: scss-declarations
67 | - include: at-rules
68 | - include: rule-terminators
69 | - include: illegal-groups
70 |
71 | ###[ CSS COMMENTS ]############################################################
72 |
73 | comments:
74 | - meta_append: true
75 | - include: sassdoc-comments
76 | - include: scss-line-comments
77 |
78 | block-comment-body:
79 | - meta_append: true
80 | - include: scss-string-interpolations
81 |
82 | ###[ CSS AT-RULES ]############################################################
83 |
84 | at-keyframe-block-body:
85 | - meta_append: true
86 | - include: scss-at-content
87 | - include: scss-at-control
88 | - include: scss-at-extend
89 | - include: scss-at-forward
90 | - include: scss-at-functions
91 | - include: scss-at-include
92 | - include: scss-at-messages
93 | - include: scss-at-mixins
94 | - include: scss-at-return
95 | - include: scss-at-root
96 | - include: scss-at-use
97 | - include: scss-declarations
98 |
99 | at-other:
100 | - meta_prepend: true
101 | - include: scss-at-content
102 | - include: scss-at-control
103 | - include: scss-at-extend
104 | - include: scss-at-forward
105 | - include: scss-at-functions
106 | - include: scss-at-include
107 | - include: scss-at-messages
108 | - include: scss-at-mixins
109 | - include: scss-at-return
110 | - include: scss-at-root
111 | - include: scss-at-use
112 |
113 | ###[ CONTAINER QUERIES ]#######################################################
114 |
115 | container-style-queries:
116 | - meta_append: true
117 | - include: scss-interpolations
118 | - include: scss-value-expressions
119 |
120 | ###[ CSS MEDIA QUERIES ]#######################################################
121 |
122 | media-query-conditions:
123 | - meta_append: true
124 | - include: scss-interpolations
125 | - include: scss-value-expressions
126 |
127 | ###[ CSS PROPERTIES OR SELECTORS ]#############################################
128 |
129 | properties-or-selectors:
130 | # required for backward compatibility with ST4169
131 | - match: '{{property_or_selector_begin}}'
132 | branch_point: property-or-selector
133 | branch:
134 | - maybe-property
135 | - maybe-nested-property
136 | - selector-body
137 |
138 | maybe-property:
139 | # required for backward compatibility with ST4169
140 | - meta_include_prototype: false
141 | - include: property-end
142 | - include: property-identifiers
143 | # otherwise it is part of a selector
144 | - match: ''
145 | fail: property-or-selector
146 |
147 | property-end:
148 | # required for backward compatibility with ST4169
149 | - match: '{{property_end}}'
150 | pop: 1
151 |
152 | maybe-nested-property:
153 | # https://sass-lang.com/documentation/style-rules/declarations/#nesting
154 | - match: (?:{{vendor_prefix}}|{{generic_ident_begin}})
155 | scope: support.type.vendor-prefix.css
156 | set:
157 | - nested-property-value
158 | - other-property-content
159 | - match: ''
160 | fail: property-or-selector
161 |
162 | nested-property-value:
163 | - meta_include_prototype: false
164 | - match: :(?=\s)
165 | scope: punctuation.separator.key-value.css
166 | set: property-value-content
167 | - match: (?=\S)
168 | fail: property-or-selector
169 |
170 | selector-body:
171 | - meta_prepend: true
172 | - include: scss-placeholder-selectors
173 | - include: scss-bem-selectors
174 |
175 | selector-ids:
176 | # replaces CSS context
177 | # distinguish id's and html tags beginning with interpolation
178 | - match: \#(?!{)
179 | scope: entity.other.attribute-name.id.css punctuation.definition.entity.css
180 | push: selector-id-identifier
181 |
182 | selector-tag-content:
183 | - meta_prepend: true
184 | - include: scss-interpolations
185 |
186 | ###[ CSS SELECTORS / ATTRIBUTE SELECTORS ]#####################################
187 |
188 | attribute-selector-key:
189 | - meta_prepend: true
190 | - include: scss-interpolations
191 |
192 | attribute-selector-unquoted-value-content:
193 | - meta_prepend: true
194 | - include: scss-interpolations
195 |
196 | ###[ CSS SELECTORS / PSEUDO CLASSES ]##########################################
197 |
198 | pseudo-class-anb-arguments-list-body:
199 | - meta_append: true
200 | - include: scss-interpolations
201 |
202 | pseudo-class-dir-arguments-list-body:
203 | - meta_append: true
204 | - include: scss-interpolations
205 |
206 | ###[ CSS PROPERTY LISTS ]######################################################
207 |
208 | maybe-property-list:
209 | # required for backward compatibility with ST4169
210 | - meta_include_prototype: false
211 | - match: \{
212 | scope: punctuation.section.block.begin.css
213 | set: property-list-body
214 | - include: comments
215 | - include: else-pop
216 |
217 | property-list-body:
218 | # required for backward compatibility with ST4169
219 | - meta_include_prototype: false
220 | - meta_scope: meta.property-list.css meta.block.css
221 | - include: block-end
222 | - include: stylesheet
223 |
224 | ###[ CSS VALUE EXPRESSIONS ]###################################################
225 |
226 | value-prototype:
227 | - meta_append: true
228 | - include: scss-default-operators
229 | - include: scss-global-operators
230 | - include: scss-value-expressions
231 |
232 | generic-font-names:
233 | # inject scss function calls to font property related contexts
234 | # without rewriting them all.
235 | - meta_prepend: true
236 | - include: scss-unqualified-functions
237 |
238 | ###[ CSS FUNCTION ARGUMENTS ]##################################################
239 |
240 | function-arguments-prototype:
241 | - meta_append: true
242 | - include: scss-value-expressions
243 |
244 | counter-function-arguments-list-body:
245 | - meta_append: true
246 | - include: scss-identifiers-or-functions
247 |
248 | font-format-function-arguments-list-body:
249 | - meta_append: true
250 | - include: scss-identifiers-or-functions
251 |
252 | format-function-arguments-list-body:
253 | - meta_append: true
254 | - include: scss-identifiers-or-functions
255 |
256 | layer-function-arguments-list-body:
257 | - meta_append: true
258 | - include: scss-identifiers-or-functions
259 |
260 | supports-function-arguments-list-body:
261 | - meta_append: true
262 | - include: scss-identifiers-or-functions
263 |
264 | symbols-function-arguments-list-body:
265 | - meta_append: true
266 | - include: scss-identifiers-or-functions
267 |
268 | color-color-function-arguments-list-body:
269 | - meta_append: true
270 | - include: scss-identifiers-or-functions
271 |
272 | hsl-color-function-arguments-list-body:
273 | - meta_content_scope: meta.function-call.arguments.css meta.group.css
274 | - include: alpha-delimiters
275 | - include: other-function-arguments-list-body
276 |
277 | rgb-color-function-arguments-list-body:
278 | - meta_content_scope: meta.function-call.arguments.css meta.group.css
279 | - include: alpha-delimiters
280 | - include: other-function-arguments-list-body
281 |
282 | blend-adjust-function-arguments-list-body:
283 | - meta_append: true
284 | - include: scss-identifiers-or-functions
285 |
286 | hue-adjust-function-arguments-list-body:
287 | - meta_append: true
288 | - include: scss-identifiers-or-functions
289 |
290 | rgba-adjust-function-arguments-list-body:
291 | - meta_append: true
292 | - include: scss-identifiers-or-functions
293 |
294 | saturation-adjust-function-arguments-list-body:
295 | - meta_append: true
296 | - include: scss-identifiers-or-functions
297 |
298 | tint-adjust-function-arguments-list-body:
299 | - meta_append: true
300 | - include: scss-identifiers-or-functions
301 |
302 | filter-function-arguments-list-body:
303 | - meta_append: true
304 | - include: scss-identifiers-or-functions
305 |
306 | blur-function-arguments-list-body:
307 | - meta_append: true
308 | - include: scss-identifiers-or-functions
309 |
310 | brightness-function-arguments-list-body:
311 | - meta_append: true
312 | - include: scss-identifiers-or-functions
313 |
314 | drop-shadow-function-arguments-list-body:
315 | - meta_append: true
316 | - include: scss-identifiers-or-functions
317 |
318 | hue-rotate-function-arguments-list-body:
319 | - meta_append: true
320 | - include: scss-identifiers-or-functions
321 |
322 | minmax-function-arguments-list-body:
323 | - meta_append: true
324 | - include: scss-identifiers-or-functions
325 |
326 | repeat-function-arguments-list-body:
327 | - meta_append: true
328 | - include: scss-identifiers-or-functions
329 |
330 | cross-fade-function-arguments-list-body:
331 | - meta_append: true
332 | - include: scss-identifiers-or-functions
333 |
334 | image-function-arguments-list-body:
335 | - meta_append: true
336 | - include: scss-identifiers-or-functions
337 |
338 | image-set-function-arguments-list-body:
339 | - meta_append: true
340 | - include: scss-identifiers-or-functions
341 |
342 | conic-gradient-function-arguments-list-body:
343 | - meta_append: true
344 | - include: scss-identifiers-or-functions
345 |
346 | radial-gradient-function-arguments-list-body:
347 | - meta_append: true
348 | - include: scss-identifiers-or-functions
349 |
350 | circle-function-arguments-list-body:
351 | - meta_append: true
352 | - include: scss-identifiers-or-functions
353 |
354 | inset-function-arguments-list-body:
355 | - meta_append: true
356 | - include: scss-identifiers-or-functions
357 |
358 | polygon-function-arguments-list-body:
359 | - meta_append: true
360 | - include: scss-identifiers-or-functions
361 |
362 | rect-function-arguments-list-body:
363 | - meta_append: true
364 | - include: scss-identifiers-or-functions
365 |
366 | cubic-bezier-timing-function-arguments-list-body:
367 | - meta_append: true
368 | - include: scss-identifiers-or-functions
369 |
370 | step-timing-function-arguments-list-body:
371 | - meta_append: true
372 | - include: scss-identifiers-or-functions
373 |
374 | transform-function-angles-arguments-list-body:
375 | - meta_append: true
376 | - include: scss-identifiers-or-functions
377 |
378 | transform-function-angles-scalars-arguments-list-body:
379 | - meta_append: true
380 | - include: scss-identifiers-or-functions
381 |
382 | transform-function-lengths-percentage-arguments-list-body:
383 | - meta_append: true
384 | - include: scss-identifiers-or-functions
385 |
386 | transform-function-scalars-percentage-arguments-list-body:
387 | - meta_append: true
388 | - include: scss-identifiers-or-functions
389 |
390 | transform-function-scalars-arguments-list-body:
391 | - meta_append: true
392 | - include: scss-identifiers-or-functions
393 |
394 | transform-function-angle-arguments-list-body:
395 | - meta_append: true
396 | - include: scss-identifiers-or-functions
397 |
398 | transform-function-length-arguments-list-body:
399 | - meta_append: true
400 | - include: scss-identifiers-or-functions
401 |
402 | transform-function-length-percentage-arguments-list-body:
403 | - meta_append: true
404 | - include: scss-identifiers-or-functions
405 |
406 | transform-function-scalar-arguments-list-body:
407 | - meta_append: true
408 | - include: scss-identifiers-or-functions
409 |
410 | url-function-arguments-list-body:
411 | - meta_content_scope: meta.function-call.arguments.css meta.group.css
412 | - include: function-arguments-prototype
413 | - include: scss-unqualified-functions
414 | - include: quoted-urls
415 | - include: unquoted-urls
416 |
417 | url-regexp-function-arguments-list-body:
418 | - meta_content_scope: meta.function-call.arguments.css meta.group.css
419 | - include: function-arguments-prototype
420 | - include: scss-unqualified-functions
421 | - include: quoted-strings
422 |
423 | calc-function-arguments-list-body:
424 | - meta_append: true
425 | - include: scss-identifiers-or-functions
426 |
427 | toggle-function-arguments-list-body:
428 | - meta_append: true
429 | - include: scss-identifiers-or-functions
430 |
431 | ###[ CSS IDENTIFIERS ]#########################################################
432 |
433 | identifier-content:
434 | - meta_prepend: true
435 | - include: scss-interpolations
436 |
437 | ###[ CSS STRINGS ]#############################################################
438 |
439 | font-family-names:
440 | # replace CSS context to add interpolation support
441 | - match: '{{ident_begin}}'
442 | push: font-family-name-body
443 |
444 | font-family-name-body:
445 | - meta_include_prototype: false
446 | - meta_scope: meta.string.css string.unquoted.css
447 | - include: scss-string-interpolations
448 | # allow unquoted space separated font names
449 | - match: (?!\s+{{ident_start}}){{break}}
450 | pop: 1
451 | # function call ahead, skip font name
452 | - match: (?=\s+{{ident}}\()
453 | pop: 1
454 | - match: '{{unicode}}'
455 |
456 | language-ranges:
457 | # replace CSS context to add interpolation support
458 | - match: '{{lang_range_begin}}'
459 | push: language-range-content
460 |
461 | line-name-content:
462 | - meta_prepend: true
463 | - include: scss-string-interpolations
464 |
465 | string-content:
466 | - meta_prepend: true
467 | - include: scss-string-interpolations
468 |
469 | ###[ CSS URL STRINGS ]#########################################################
470 |
471 | quoted-url:
472 | # does not yet exist in CSS but is not unlikely
473 | - match: \"
474 | scope:
475 | meta.string.css string.quoted.double.css
476 | punctuation.definition.string.begin.css
477 | set: double-quoted-url-body
478 | - match: \'
479 | scope:
480 | meta.string.css string.quoted.single.css
481 | punctuation.definition.string.begin.css
482 | set: single-quoted-url-body
483 |
484 | unquoted-urls:
485 | # replace CSS context to add interpolation support
486 | - match: '{{unquoted_url_begin}}'
487 | push: unquoted-url-body
488 |
489 | unquoted-url-body:
490 | - meta_prepend: true
491 | - include: scss-string-interpolations
492 |
493 | ###[ SassDoc COMMENTS ]########################################################
494 |
495 | sassdoc-comments:
496 | - match: /{3}
497 | scope: punctuation.definition.comment.sassdoc.scss
498 | push: sassdoc-comments-body
499 |
500 | sassdoc-comments-body:
501 | - meta_scope: comment.line.double-slash.scss comment.line.documentation.sassdoc.scss
502 | - include: Packages/Markdown/Markdown.sublime-syntax#bold
503 | - include: Packages/Markdown/Markdown.sublime-syntax#italic
504 | - include: Packages/Markdown/Markdown.sublime-syntax#code-spans
505 | # @TODO maybe consider markdown inline links, images
506 | - match: \@\w+(?=\s|$)
507 | scope: entity.name.tag.documentation.sassdoc.scss
508 | - match: \n
509 | pop: 1
510 |
511 | ###[ SCSS COMMENTS ]###########################################################
512 |
513 | scss-line-comments:
514 | - match: /{2}
515 | scope: punctuation.definition.comment.scss
516 | push: scss-line-comments-body
517 |
518 | scss-line-comments-body:
519 | - meta_scope: comment.line.double-slash.scss
520 | - match: \n
521 | pop: 1
522 |
523 | ###[ SCSS CONTENT AT-RULE ]####################################################
524 |
525 | scss-at-content:
526 | # https://sass-lang.com/documentation/at-rules/mixin/#content-blocks
527 | - match: (@)content{{break}}
528 | scope: meta.placeholder.scss keyword.control.directive.content.scss
529 | captures:
530 | 1: punctuation.definition.keyword.scss
531 | push:
532 | - scss-at-content-meta
533 | - scss-at-content-argument-list
534 |
535 | scss-at-content-meta:
536 | - meta_include_prototype: false
537 | - meta_scope: meta.at-rule.content.scss
538 | - include: immediately-pop
539 |
540 | scss-at-content-argument-list:
541 | - meta_include_prototype: false
542 | - meta_content_scope: meta.placeholder.scss
543 | - match: \(
544 | scope: punctuation.section.group.begin.scss
545 | set: scss-at-content-argument-list-body
546 | - include: else-pop
547 |
548 | scss-at-content-argument-list-body:
549 | - meta_scope: meta.placeholder.arguments.scss meta.group.scss
550 | - include: scss-group-end
551 | - include: scss-arguments
552 | - include: values
553 |
554 | ###[ SCSS CONTROL FLOW AT-RULE ]###############################################
555 |
556 | scss-at-control:
557 | # conditional
558 | - match: (@)if{{break}}
559 | scope: keyword.control.conditional.if.scss
560 | captures:
561 | 1: punctuation.definition.keyword.scss
562 | push: scss-at-coditional-body
563 | - match: (@)else if{{break}}
564 | scope: keyword.control.conditional.elseif.scss
565 | captures:
566 | 1: punctuation.definition.keyword.scss
567 | push: scss-at-coditional-body
568 | - match: (@)else{{break}}
569 | scope: keyword.control.conditional.else.scss
570 | captures:
571 | 1: punctuation.definition.keyword.scss
572 | push: scss-at-coditional-body
573 | # loops
574 | - match: (@)each{{break}}
575 | scope: keyword.control.loop.each.scss
576 | captures:
577 | 1: punctuation.definition.keyword.scss
578 | push: scss-at-each-body
579 | - match: (@)for{{break}}
580 | scope: keyword.control.loop.for.scss
581 | captures:
582 | 1: punctuation.definition.keyword.scss
583 | push: scss-at-for-body
584 | - match: (@)while{{break}}
585 | scope: keyword.control.loop.while.scss
586 | captures:
587 | 1: punctuation.definition.keyword.scss
588 | push: scss-at-while-body
589 |
590 | scss-at-coditional-body:
591 | - meta_scope: meta.at-rule.conditional.scss
592 | - include: values
593 |
594 | scss-at-each-body:
595 | - meta_scope: meta.at-rule.each.scss
596 | - match: in{{break}}
597 | scope: keyword.operator.iteration.scss
598 | push: scss-at-each-in-body
599 | - include: comma-delimiters
600 | - include: scss-interpolations
601 | - include: scss-variables
602 | - include: terminator-pop
603 |
604 | scss-at-each-in-body:
605 | - include: scss-expressions
606 | - include: terminator-pop
607 |
608 | scss-at-for-body:
609 | - meta_scope: meta.at-rule.for.scss
610 | - match: (?:from|to|through){{break}}
611 | scope: keyword.operator.iteration.scss
612 | - include: values
613 |
614 | scss-at-while-body:
615 | - meta_scope: meta.at-rule.while.scss
616 | - include: scss-expressions
617 | - include: terminator-pop
618 |
619 | scss-at-return:
620 | - match: (@)return{{break}}
621 | scope: keyword.control.flow.return.scss
622 | captures:
623 | 1: punctuation.definition.keyword.scss
624 | push: scss-at-return-value
625 |
626 | scss-at-return-value:
627 | - meta_scope: meta.at-rule.return.scss
628 | - include: values
629 |
630 | ###[ SCSS DEBUG/ERROR/WARN AT-RULE ]###########################################
631 |
632 | scss-at-messages:
633 | - match: (@)debug{{break}}
634 | scope: keyword.control.at-rule.debug.scss
635 | captures:
636 | 1: punctuation.definition.keyword.scss
637 | push: scss-at-message-body
638 | - match: (@)error{{break}}
639 | scope: keyword.control.at-rule.error.scss
640 | captures:
641 | 1: punctuation.definition.keyword.scss
642 | push: scss-at-message-body
643 | - match: (@)warn{{break}}
644 | scope: keyword.control.at-rule.warn.scss
645 | captures:
646 | 1: punctuation.definition.keyword.scss
647 | push: scss-at-message-body
648 |
649 | scss-at-message-body:
650 | - meta_scope: meta.at-rule.message.scss
651 | - include: values
652 |
653 | ###[ SCSS EXTEND AT-RULE ]#####################################################
654 |
655 | scss-at-extend:
656 | - match: (@)extend{{break}}
657 | scope: keyword.control.directive.extend.scss
658 | captures:
659 | 1: punctuation.definition.keyword.scss
660 | push: scss-at-extend-body
661 |
662 | scss-at-extend-body:
663 | - meta_scope: meta.at-rule.extend.scss
664 | - meta_content_scope: meta.selector.css
665 | - include: selector-body
666 |
667 | ###[ SCSS FORWARD/USE AT-RULE ]################################################
668 |
669 | scss-at-forward:
670 | # https://sass-lang.com/documentation/at-rules/forward/
671 | - match: (@)forward{{break}}
672 | scope: keyword.control.directive.forward.scss
673 | captures:
674 | 1: punctuation.definition.keyword.scss
675 | push:
676 | - scss-at-forward-meta
677 | - scss-module-with
678 | - scss-module-visibility
679 | - scss-module-as
680 | - scss-module-url
681 |
682 | scss-at-forward-meta:
683 | - meta_include_prototype: false
684 | - meta_scope: meta.at-rule.forward.scss
685 | - meta_content_scope: meta.module.scss
686 | - include: immediately-pop
687 |
688 | scss-at-use:
689 | # https://sass-lang.com/documentation/at-rules/use/
690 | - match: (@)use{{break}}
691 | scope: keyword.control.directive.use.scss
692 | captures:
693 | 1: punctuation.definition.keyword.scss
694 | push:
695 | - scss-at-use-meta
696 | - scss-module-with
697 | - scss-module-as
698 | - scss-module-url
699 |
700 | scss-at-use-meta:
701 | - meta_include_prototype: false
702 | - meta_scope: meta.at-rule.use.scss
703 | - meta_content_scope: meta.module.scss
704 | - include: immediately-pop
705 |
706 | scss-module-url:
707 | - meta_include_prototype: false
708 | - include: quoted-url
709 | - include: comments
710 | - include: else-pop
711 |
712 | scss-module-as:
713 | - meta_include_prototype: false
714 | - match: as{{break}}
715 | scope: keyword.operator.assignment.as.scss
716 | set: scss-module-as-value
717 | - include: comments
718 | - include: else-pop
719 |
720 | scss-module-as-value:
721 | - clear_scopes: 1
722 | - meta_scope: meta.module.alias.scss
723 | - match: '{{ident}}(\*)?'
724 | scope: meta.generic-name.scss
725 | captures:
726 | 1: constant.other.wildcard.asterisk.scss
727 | pop: 1
728 | - match: \*
729 | scope: constant.other.wildcard.asterisk.scss
730 | pop: 1
731 | - include: comments
732 | - include: else-pop
733 |
734 | scss-module-visibility:
735 | - meta_include_prototype: false
736 | - match: hide{{break}}
737 | scope: keyword.control.visibility.hide.scss
738 | push: scss-module-visibility-value
739 | - match: show{{break}}
740 | scope: keyword.control.visibility.show.scss
741 | push: scss-module-visibility-value
742 | - include: comments
743 | - include: else-pop
744 |
745 | scss-module-visibility-value:
746 | - clear_scopes: 1
747 | - meta_scope: meta.module.visibility.scss
748 | - match: (?=(?:hide|show|with){{break}})
749 | pop: 1
750 | - include: scss-expressions
751 | - include: else-pop
752 |
753 | scss-module-with:
754 | - meta_include_prototype: false
755 | - match: with{{break}}
756 | scope: keyword.control.with.scss
757 | set: scss-module-arguments-list
758 | - include: comments
759 | - include: else-pop
760 |
761 | scss-module-arguments-list:
762 | - meta_include_prototype: false
763 | - match: \(
764 | scope: punctuation.section.group.begin.scss
765 | set: scss-module-arguments-list-body
766 | - include: comments
767 | - include: else-pop
768 |
769 | scss-module-arguments-list-body:
770 | - clear_scopes: 1
771 | - meta_scope: meta.module.arguments.scss meta.group.scss
772 | - include: scss-group-end
773 | - include: scss-arguments
774 | - include: values
775 |
776 | ###[ SCSS FUNCTION AT-RULE ]###################################################
777 |
778 | scss-at-functions:
779 | - match: (@)function{{break}}
780 | scope: meta.function.scss keyword.control.directive.function.scss
781 | captures:
782 | 1: punctuation.definition.keyword.scss
783 | push:
784 | - scss-at-function-meta
785 | - maybe-property-list
786 | - scss-at-function-name
787 |
788 | scss-at-function-meta:
789 | - meta_include_prototype: false
790 | - meta_scope: meta.at-rule.function.scss
791 | - include: immediately-pop
792 |
793 | scss-at-function-name:
794 | - meta_content_scope: meta.function.scss
795 | - match: '{{ident}}'
796 | scope: meta.function.identifier.scss entity.name.function.scss
797 | set: scss-at-function-parameter-list
798 | - include: comments
799 | - include: else-pop
800 |
801 | scss-at-function-parameter-list:
802 | - meta_include_prototype: false
803 | - meta_content_scope: meta.function.identifier.scss
804 | - match: \(
805 | scope: punctuation.section.group.begin.scss
806 | set: scss-at-function-parameter-list-body
807 | - include: comments
808 | - include: else-pop
809 |
810 | scss-at-function-parameter-list-body:
811 | - meta_scope: meta.function.parameters.scss meta.group.scss
812 | - include: scss-group-end
813 | - include: comments
814 | - include: comma-delimiters
815 | - include: scss-variadics
816 | - include: scss-parameters
817 |
818 | ###[ SCSS MIXIN AT-RULE ]######################################################
819 |
820 | scss-at-mixins:
821 | - match: (@)mixin{{break}}
822 | scope: meta.mixin.scss keyword.control.directive.mixin.scss
823 | captures:
824 | 1: punctuation.definition.keyword.scss
825 | push:
826 | - scss-at-mixin-meta
827 | - maybe-property-list
828 | - scss-at-mixin-name
829 |
830 | scss-at-mixin-meta:
831 | - meta_include_prototype: false
832 | - meta_scope: meta.at-rule.mixin.scss
833 | - include: immediately-pop
834 |
835 | scss-at-mixin-name:
836 | - meta_content_scope: meta.mixin.scss
837 | - match: '{{ident}}'
838 | scope: meta.mixin.identifier.scss entity.name.mixin.scss
839 | set: scss-at-mixin-parameter-list
840 | - include: comments
841 | - include: else-pop
842 |
843 | scss-at-mixin-parameter-list:
844 | - meta_include_prototype: false
845 | - meta_content_scope: meta.mixin.identifier.scss
846 | - match: \(
847 | scope: punctuation.section.group.begin.scss
848 | set: scss-at-mixin-parameter-list-body
849 | - include: comments
850 | - include: else-pop
851 |
852 | scss-at-mixin-parameter-list-body:
853 | - meta_scope: meta.mixin.parameters.scss meta.group.scss
854 | - include: scss-group-end
855 | - include: comments
856 | - include: comma-delimiters
857 | - include: scss-variadics
858 | - include: scss-parameters
859 |
860 | ###[ SCSS INCLUDE AT-RULE ]####################################################
861 |
862 | scss-at-include:
863 | # https://sass-lang.com/documentation/at-rules/mixin/
864 | - match: (@)include{{break}}
865 | scope: keyword.control.directive.include.scss
866 | captures:
867 | 1: punctuation.definition.keyword.scss
868 | push:
869 | - scss-at-include-meta
870 | - maybe-property-list
871 | - scss-at-include-using
872 | - scss-at-include-mixin
873 |
874 | scss-at-include-meta:
875 | - meta_include_prototype: false
876 | - meta_scope: meta.at-rule.include.scss
877 | - include: immediately-pop
878 |
879 | scss-at-include-mixin:
880 | - match: ({{ident}})(\.)
881 | scope: meta.mixin.scss
882 | captures:
883 | 1: variable.namespace.scss
884 | 2: punctuation.accessor.dot.scss
885 | - match: '{{ident}}'
886 | scope: meta.mixin.scss variable.other.mixin.scss
887 | set: scss-mixin-argument-list
888 | - include: comments
889 | - include: else-pop
890 |
891 | scss-mixin-argument-list:
892 | - meta_include_prototype: false
893 | - meta_content_scope: meta.mixin.scss
894 | - match: \(
895 | scope: punctuation.section.group.begin.scss
896 | set: scss-mixin-argument-list-body
897 | - include: else-pop
898 |
899 | scss-mixin-argument-list-body:
900 | - meta_scope: meta.mixin.arguments.scss meta.group.scss
901 | - include: scss-group-end
902 | - include: scss-arguments
903 | - include: values
904 |
905 | scss-at-include-using:
906 | # https://sass-lang.com/documentation/at-rules/mixin/#passing-arguments-to-content-blocks
907 | - match: using{{break}}
908 | scope: meta.using.scss keyword.control.using.scss
909 | set: scss-at-include-using-parameter-list
910 | - include: comments
911 | - include: else-pop
912 |
913 | scss-at-include-using-parameter-list:
914 | - meta_include_prototype: false
915 | - meta_content_scope: meta.using.scss
916 | - match: \(
917 | scope: punctuation.section.group.begin.scss
918 | set: scss-at-include-using-parameter-list-body
919 | - include: comments
920 | - include: else-pop
921 |
922 | scss-at-include-using-parameter-list-body:
923 | - meta_scope: meta.using.parameters.scss meta.group.scss
924 | - include: scss-group-end
925 | - include: comments
926 | - include: comma-delimiters
927 | - include: scss-variadics
928 | - include: scss-parameters
929 |
930 | ###[ SCSS ROOT AT-RULE ]#######################################################
931 |
932 | scss-at-root:
933 | - match: (@)at-root{{break}}
934 | scope: keyword.control.directive.root.scss
935 | captures:
936 | 1: punctuation.definition.keyword.scss
937 | push: scss-at-root-body
938 |
939 | scss-at-root-body:
940 | - meta_scope: meta.at-rule.root.scss
941 | - meta_content_scope: meta.selector.css
942 | - match: \(
943 | scope: punctuation.section.group.begin.scss
944 | push: scss-at-root-group-body
945 | - include: selector-body
946 |
947 | scss-at-root-group-body:
948 | - meta_scope: meta.group.scss
949 | - include: scss-group-end
950 | - match: (with|without)\s*(:)
951 | captures:
952 | 1: keyword.control.scss
953 | 2: punctuation.separator.key-value.css
954 | - include: values
955 |
956 | ###[ SCSS SELECTORS ]##########################################################
957 |
958 | scss-bem-selectors:
959 | # &--bem_ish selectors
960 | # https://sass-lang.com/documentation/style-rules/parent-selector/#adding-suffixes
961 | - match: \&(?=[-_])
962 | scope: variable.language.parent.css
963 | push: scss-bem-selector-content
964 |
965 | scss-bem-selector-content:
966 | - meta_content_scope: entity.other.attribute-name.css
967 | - include: identifier-content
968 |
969 | scss-placeholder-selectors:
970 | # https://sass-lang.com/documentation/style-rules/placeholder-selectors/
971 | - match: \%
972 | scope: punctuation.definition.entity.placeholder.scss
973 | # has same basic properties as a classname
974 | push: selector-class-identifier-content
975 |
976 | ###[ SCSS EXPRESSIONS ]########################################################
977 |
978 | scss-value-expressions:
979 | # for use in CSS contexts
980 | - include: scss-declarations
981 | - include: scss-constants
982 | - include: scss-variables
983 | - include: scss-operators
984 | - include: scss-variadics
985 | - include: scss-groups-or-maps
986 | - include: scss-qualified-functions
987 |
988 | scss-expressions:
989 | # for use in SCSS contexts where we try to "guess" more types of values
990 | - include: comments
991 | - include: comma-delimiters
992 | - include: builtin-functions
993 | - include: color-values
994 | - include: unicode-ranges
995 | - include: none-constants
996 | - include: numeric-constants
997 | - include: quoted-strings
998 | - include: scss-constants
999 | - include: scss-variables
1000 | - include: scss-operators
1001 | - include: scss-variadics
1002 | - include: scss-groups-or-maps
1003 | - include: scss-qualified-functions
1004 | - include: scss-identifiers-or-functions
1005 |
1006 | ###[ SCSS INTERPOLATION ]######################################################
1007 |
1008 | scss-interpolations:
1009 | - match: (#)({)
1010 | captures:
1011 | 1: punctuation.definition.variable.scss
1012 | 2: punctuation.section.interpolation.begin.scss
1013 | push: scss-interpolation-body
1014 |
1015 | scss-interpolation-body:
1016 | - meta_scope: meta.interpolation.scss
1017 | - match: \}
1018 | scope: punctuation.section.interpolation.end.scss
1019 | pop: 1
1020 | - include: scss-expressions
1021 |
1022 | scss-string-interpolations:
1023 | - match: (#)({)
1024 | captures:
1025 | 1: punctuation.definition.variable.scss
1026 | 2: punctuation.section.interpolation.begin.scss
1027 | push: scss-string-interpolation-body
1028 |
1029 | scss-string-interpolation-body:
1030 | - clear_scopes: 1
1031 | - meta_scope: meta.interpolation.scss
1032 | - match: \}
1033 | scope: punctuation.section.interpolation.end.scss
1034 | pop: 1
1035 | - include: scss-expressions
1036 |
1037 | ###[ SCSS GROUPS OR MAPS ]#####################################################
1038 |
1039 | scss-groups-or-maps:
1040 | - match: (?=\()
1041 | branch_point: group-or-map
1042 | branch:
1043 | - scss-group
1044 | - scss-mapping
1045 |
1046 | scss-group:
1047 | - meta_include_prototype: false
1048 | - match: \(
1049 | scope: punctuation.section.group.begin.scss
1050 | set:
1051 | - scss-group-body
1052 | - scss-maybe-operator
1053 |
1054 | scss-group-body:
1055 | - meta_scope: meta.group.scss
1056 | - include: scss-group-end
1057 | - match: ':'
1058 | fail: group-or-map
1059 | - include: scss-expressions
1060 |
1061 | scss-group-end:
1062 | - match: \)
1063 | scope: punctuation.section.group.end.scss
1064 | pop: 1
1065 |
1066 | scss-mapping:
1067 | - meta_include_prototype: false
1068 | - match: \(
1069 | scope: punctuation.section.mapping.begin.scss
1070 | set: scss-mapping-body
1071 |
1072 | scss-mapping-body:
1073 | - meta_include_prototype: false
1074 | - meta_scope: meta.mapping.scss
1075 | - match: \)
1076 | scope: punctuation.section.mapping.end.scss
1077 | pop: 1
1078 | - include: comments
1079 | - include: comma-delimiters
1080 | - match: ':'
1081 | scope: meta.mapping.scss punctuation.separator.key-value.css
1082 | push: scss-mapping-value
1083 | - match: (?=\S)
1084 | push: scss-mapping-key
1085 |
1086 | scss-mapping-key:
1087 | - clear_scopes: 1
1088 | - meta_content_scope: meta.mapping.key.scss
1089 | - include: scss-interpolations
1090 | - include: scss-variables
1091 | - include: quoted-strings
1092 | - include: immediately-pop
1093 |
1094 | scss-mapping-value:
1095 | - clear_scopes: 1
1096 | - meta_content_scope: meta.mapping.value.scss
1097 | - match: (?=,)
1098 | pop: 1
1099 | - include: values
1100 |
1101 | ###[ SCSS FUNCTION CALLS ]#####################################################
1102 |
1103 | scss-qualified-functions:
1104 | # qualified functions always belong to SCSS
1105 | - match: ({{ident}})(\.)({{ident}})(?=\()
1106 | scope: meta.function-call.identifier.css
1107 | captures:
1108 | 1: variable.namespace.scss
1109 | 2: punctuation.accessor.dot.scss
1110 | 3: support.function.scss
1111 | push:
1112 | - other-function-arguments-list-body
1113 | - function-arguments-list-begin
1114 |
1115 | scss-unqualified-functions:
1116 | # unqualified functions may belong to SCSS or CSS
1117 | - match: (?={{ident}}\()
1118 | push: other-function
1119 |
1120 | scss-identifiers-or-functions:
1121 | - match: '{{ident_begin}}'
1122 | branch_point: scss-identifier-or-function
1123 | branch:
1124 | - scss-identifier
1125 | - other-function
1126 |
1127 | scss-identifier:
1128 | - meta_content_scope: meta.generic-name.scss
1129 | - match: (?=\()
1130 | fail: scss-identifier-or-function
1131 | - include: identifier-content
1132 |
1133 | ###[ SCSS CONSTANTS ]##########################################################
1134 |
1135 | scss-constants:
1136 | - match: true{{break}}
1137 | scope: constant.language.boolean.true.scss
1138 | - match: false{{break}}
1139 | scope: constant.language.boolean.false.scss
1140 | - match: null{{break}}
1141 | scope: constant.language.null.scss
1142 |
1143 | ###[ SCSS OPERATORS ]##########################################################
1144 |
1145 | scss-default-operators:
1146 | - match: \!\s*(?i:default){{break}}
1147 | scope: keyword.other.default.scss
1148 |
1149 | scss-global-operators:
1150 | - match: \!\s*(?i:global){{break}}
1151 | scope: keyword.other.global.scss
1152 |
1153 | scss-maybe-operator:
1154 | - meta_include_prototype: false
1155 | # maybe unary operator
1156 | - match: '[-+]'
1157 | scope: keyword.operator.arithmetic.scss
1158 | pop: 1
1159 | - include: comments
1160 | - include: else-pop
1161 |
1162 | scss-operators:
1163 | - match: '[-+*/%](?=[\s$(])'
1164 | scope: keyword.operator.arithmetic.scss
1165 | - match: (?:[=!<>]=|<|>)
1166 | scope: keyword.operator.comparison.scss
1167 | - match: (?:and|not|or|when){{break}}
1168 | scope: keyword.operator.logical.scss
1169 |
1170 | scss-variadics:
1171 | - match: \.{3}
1172 | scope: keyword.operator.variadic.scss
1173 |
1174 | ###[ SCSS ARGUMENTS ]##########################################################
1175 |
1176 | scss-arguments:
1177 | # mixin argument assignments
1178 | - match: (((\$){{ident}})\s*)(:)
1179 | captures:
1180 | 1: meta.argument.identifier.scss
1181 | 2: variable.parameter.scss
1182 | 3: punctuation.definition.variable.scss
1183 | 4: meta.argument.scss punctuation.separator.key-value.css
1184 | push: scss-argument-value
1185 |
1186 | scss-argument-value:
1187 | - meta_content_scope: meta.argument.value.scss
1188 | - match: ','
1189 | scope: punctuation.separator.sequence.css
1190 | pop: 1
1191 | - include: values
1192 |
1193 | ###[ SCSS DECLARATIONS ]#######################################################
1194 |
1195 | scss-declarations:
1196 | - match: (((\$){{ident}})\s*)(:)
1197 | captures:
1198 | 1: meta.declaration.identifier.scss
1199 | 2: variable.other.scss
1200 | 3: punctuation.definition.variable.scss
1201 | 4: meta.declaration.scss punctuation.separator.key-value.css
1202 | push: scss-declaration-value
1203 |
1204 | scss-declaration-value:
1205 | - meta_content_scope: meta.declaration.value.scss
1206 | - include: values
1207 |
1208 | ###[ SCSS PARAMETERS ]#########################################################
1209 |
1210 | scss-parameters:
1211 | # mixin parameter declarations
1212 | - match: (\$){{ident}}
1213 | scope: meta.parameter.identifier.scss variable.parameter.scss
1214 | captures:
1215 | 1: punctuation.definition.variable.scss
1216 | - match: ':'
1217 | scope: meta.parameter.scss punctuation.separator.key-value.css
1218 | push: scss-parameter-value
1219 |
1220 | scss-parameter-value:
1221 | - meta_content_scope: meta.parameter.value.scss
1222 | - match: ','
1223 | scope: punctuation.separator.sequence.css
1224 | pop: 1
1225 | - include: values
1226 |
1227 | ###[ SCSS VARIABLES ]##########################################################
1228 |
1229 | scss-variables:
1230 | - match: (?:({{ident}})(\.))?((\$){{ident}})
1231 | captures:
1232 | 1: variable.namespace.scss
1233 | 2: punctuation.accessor.dot.scss
1234 | 3: variable.other.scss
1235 | 4: punctuation.definition.variable.scss
1236 |
--------------------------------------------------------------------------------
/Syntaxes/Sass.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | // Set to true to disable default completions.
3 | "disable_default_completions": false,
4 |
5 | // Controls what scopes default completions will be provided in.
6 | // Can be a list of strings which are joined before matching.
7 | "default_completions_selector": "source.sass - source.sass comment - source.sass meta.embedded - source.sass source - source.sass text",
8 |
9 | // Default separators except `-`
10 | "word_separators": "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?",
11 |
12 | // Default separator and additional `-`
13 | "sub_word_separators": "_-",
14 | }
15 |
--------------------------------------------------------------------------------
/messages.json:
--------------------------------------------------------------------------------
1 | {
2 | "3.0.0": "messages/3.0.0.txt",
3 | "4.0.0": "messages/4.0.0.txt"
4 | }
5 |
--------------------------------------------------------------------------------
/messages/3.0.0.txt:
--------------------------------------------------------------------------------
1 | Sass 3.0 Is Here!
2 |
3 | This syntax package for Sass and SCSS has been largely rewritten.
4 | This brings it more in line with the default CSS package.
5 |
6 | If you're seeing differences in highlighting, that's probably why.
7 | If you see any problems, please report them and we'll sort them out ASAP!
8 | https://github.com/braver/Sass
9 |
--------------------------------------------------------------------------------
/messages/4.0.0.txt:
--------------------------------------------------------------------------------
1 | Sass for Sublime Text 4.0
2 | -------------------------
3 |
4 | 4.0 brings an almost complete rewrite of the SCSS syntax for Sublime.
5 | This includes:
6 | - improved support for various CSS features
7 | - improved completions
8 | - improved goto definition and symbol lists
9 | - various bugfixes
10 |
--------------------------------------------------------------------------------
/plugin.py:
--------------------------------------------------------------------------------
1 | from .plugins.completions import *
2 |
--------------------------------------------------------------------------------
/plugins/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SublimeText/Sass/c0830cb89422c98a0b9b327135b8477dc62ef350/plugins/__init__.py
--------------------------------------------------------------------------------
/plugins/completions/__init__.py:
--------------------------------------------------------------------------------
1 | from .provider import *
2 |
--------------------------------------------------------------------------------
/plugins/completions/common.py:
--------------------------------------------------------------------------------
1 | def get_common_values():
2 | common_values = {
3 | "animation-direction": ["alternate", "alternate-reverse", "normal", "reverse"],
4 | "absolute-size": [
5 | "xx-small",
6 | "x-small",
7 | "small",
8 | "medium",
9 | "large",
10 | "x-large",
11 | "xx-large",
12 | ],
13 | "absolute-weight": [
14 | "100",
15 | "200",
16 | "300",
17 | "400",
18 | "500",
19 | "600",
20 | "700",
21 | "800",
22 | "900",
23 | "normal",
24 | "bold",
25 | ],
26 | "axis": ["block", "inline", "vertical", "horizontal"],
27 | "baseline-position": ["firstbaseline", "lastbaseline", "baseline"],
28 | "basic-shape": [
29 | ["circle()", "circle($1)"],
30 | ["ellipse()", "ellipse($1)"],
31 | ["inset()", "inset($1)"],
32 | ["polygon()", "polygon($1)"],
33 | ],
34 | "blend-mode": [
35 | "normal",
36 | "multiply",
37 | "screen",
38 | "overlay",
39 | "darken",
40 | "lighten",
41 | "color-dodge",
42 | "color-burn",
43 | "hard-light",
44 | "soft-light",
45 | "difference",
46 | "exclusion",
47 | "hue",
48 | "saturation",
49 | "color",
50 | "luminosity",
51 | ],
52 | "border-style": [
53 | "none",
54 | "hidden",
55 | "dotted",
56 | "dashed",
57 | "solid",
58 | "double",
59 | "groove",
60 | "ridge",
61 | "inset",
62 | "outset",
63 | ],
64 | "border-width": ["thin", "medium", "thick"],
65 | "break-before-after": [
66 | "always",
67 | "left",
68 | "right",
69 | "recto",
70 | "verso",
71 | "page",
72 | "column",
73 | "region",
74 | ],
75 | "break-inside": ["auto", "avoid", "avoid-page", "avoid-column", "avoid-region"],
76 | "calc": [
77 | ["acos()", "acos($1)"],
78 | ["asin()", "asin($1)"],
79 | ["atan()", "atan($1)"],
80 | ["atan2()", "atan2($1)"],
81 | ["calc()", "calc($1)"],
82 | ["clamp()", "clamp(${1:0}, ${2:0}, ${3:0})"],
83 | ["cos()", "cos($1)"],
84 | ["exp()", "exp($1)"],
85 | ["hypot()", "hypot($1)"],
86 | ["log()", "log($1)"],
87 | ["max()", "max(${1:0}, ${2:0})"],
88 | ["min()", "min(${1:0}, ${2:0})"],
89 | ["mod()", "mod(${1:0}, ${2:0})"],
90 | ["pow()", "pow(${1:0}, ${2:0})"],
91 | ["rem()", "rem(${1:0}, ${2:0})"],
92 | ["round()", "round(${1:0}, ${2:0}, ${3:0})"],
93 | ["sign()", "sign($1)"],
94 | ["sin()", "sin($1)"],
95 | ["sqrt()", "sqrt($1)"],
96 | ["tan()", "tan($1)"],
97 | ],
98 | "caret-color": ["auto", ""],
99 | "caret-shape": ["auto", "bar", "block", "underscore"],
100 | "color": [
101 | "currentColor",
102 | "transparent",
103 | ["rgb()", "rgb(${1:0}, ${2:0}, ${3:0}${4: / ${5:1.0}})"],
104 | ["rgba()", "rgba(${1:0}, ${2:0}, ${3:0}, ${4:1.0})"],
105 | ["hsl()", "hsl(${1:0}, ${2:100%}, ${3:50%}${4: / ${5:1.0}})"],
106 | ["hsla()", "hsla(${1:0}, ${2:100%}, ${3:50%}, ${4:1.0})"],
107 | ["hwb()", "hwb(${1:0}, ${2:100%}, ${3:50%}${4: / ${5:1.0}})"],
108 | ["lab()", "lab(${1:0%}, ${2:0}, ${3:0}${4: / ${5:1.0}})"],
109 | ["lch()", "lch(${1:0%}, ${2:0.0}, ${3:0.0}${4: / ${5:1.0}})"],
110 | ["light-dark()", "light-dark(${1}, ${2})"],
111 | ["oklab()", "oklab(${1:0%}, ${2:0}, ${3:0}${4: / ${5:1.0}})"],
112 | ["oklch()", "oklch(${1:0%}, ${2:0.0}, ${3:0.0}${4: / ${5:1.0}})"],
113 | # Named colors
114 | "aliceblue",
115 | "antiquewhite",
116 | "aqua",
117 | "aquamarine",
118 | "azure",
119 | "beige",
120 | "bisque",
121 | "black",
122 | "blanchedalmond",
123 | "blue",
124 | "blueviolet",
125 | "brown",
126 | "burlywood",
127 | "cadetblue",
128 | "chartreuse",
129 | "chocolate",
130 | "coral",
131 | "cornflowerblue",
132 | "cornsilk",
133 | "crimson",
134 | "cyan",
135 | "darkblue",
136 | "darkcyan",
137 | "darkgoldenrod",
138 | "darkgray",
139 | "darkgrey",
140 | "darkgreen",
141 | "darkkhaki",
142 | "darkmagenta",
143 | "darkolivegreen",
144 | "darkorange",
145 | "darkorchid",
146 | "darkred",
147 | "darksalmon",
148 | "darkseagreen",
149 | "darkslateblue",
150 | "darkslategray",
151 | "darkslategrey",
152 | "darkturquoise",
153 | "darkviolet",
154 | "deeppink",
155 | "deepskyblue",
156 | "dimgray",
157 | "dimgrey",
158 | "dodgerblue",
159 | "firebrick",
160 | "floralwhite",
161 | "forestgreen",
162 | "fuchsia",
163 | "gainsboro",
164 | "ghostwhite",
165 | "gold",
166 | "goldenrod",
167 | "gray",
168 | "grey",
169 | "green",
170 | "greenyellow",
171 | "honeydew",
172 | "hotpink",
173 | "indianred",
174 | "indigo",
175 | "ivory",
176 | "khaki",
177 | "lavender",
178 | "lavenderblush",
179 | "lawngreen",
180 | "lemonchiffon",
181 | "lightblue",
182 | "lightcoral",
183 | "lightcyan",
184 | "lightgoldenrodyellow",
185 | "lightgray",
186 | "lightgrey",
187 | "lightgreen",
188 | "lightpink",
189 | "lightsalmon",
190 | "lightseagreen",
191 | "lightskyblue",
192 | "lightslategray",
193 | "lightslategrey",
194 | "lightsteelblue",
195 | "lightyellow",
196 | "lime",
197 | "limegreen",
198 | "linen",
199 | "magenta",
200 | "maroon",
201 | "mediumaquamarine",
202 | "mediumblue",
203 | "mediumorchid",
204 | "mediumpurple",
205 | "mediumseagreen",
206 | "mediumslateblue",
207 | "mediumspringgreen",
208 | "mediumturquoise",
209 | "mediumvioletred",
210 | "midnightblue",
211 | "mintcream",
212 | "mistyrose",
213 | "moccasin",
214 | "navajowhite",
215 | "navy",
216 | "oldlace",
217 | "olive",
218 | "olivedrab",
219 | "orange",
220 | "orangered",
221 | "orchid",
222 | "palegoldenrod",
223 | "palegreen",
224 | "paleturquoise",
225 | "palevioletred",
226 | "papayawhip",
227 | "peachpuff",
228 | "peru",
229 | "pink",
230 | "plum",
231 | "powderblue",
232 | "purple",
233 | "rebeccapurple",
234 | "red",
235 | "rosybrown",
236 | "royalblue",
237 | "saddlebrown",
238 | "salmon",
239 | "sandybrown",
240 | "seagreen",
241 | "seashell",
242 | "sienna",
243 | "silver",
244 | "skyblue",
245 | "slateblue",
246 | "slategray",
247 | "slategrey",
248 | "snow",
249 | "springgreen",
250 | "steelblue",
251 | "tan",
252 | "teal",
253 | "thistle",
254 | "tomato",
255 | "turquoise",
256 | "violet",
257 | "wheat",
258 | "white",
259 | "whitesmoke",
260 | "yellow",
261 | "yellowgreen",
262 | ],
263 | "container-type": ["normal", "size", "inline-size"],
264 | "content-distribution": ["space-between", "space-around", "space-evenly", "stretch"],
265 | "content-position": ["center", "start", "end", "flex-start", "flex-end"],
266 | "counter-style": [["symbols()", "symbols($1)"]],
267 | "counter-symbols": [
268 | "cyclic",
269 | "numeric",
270 | "alphabetic",
271 | "symbolic",
272 | "additive",
273 | "fixed",
274 | ],
275 | "ending-shape": ["circle", "ellipse"],
276 | "fill-rule": ["nonzero", "evenodd"],
277 | "filter-function": [
278 | ["blur()", "blur($1)"],
279 | ["brightness()", "brightness($1)"],
280 | ["contrast()", "contrast($1)"],
281 | ["drop-shadow()", "drop-shadow($1)"],
282 | ["grayscale()", "grayscale($1)"],
283 | ["hue-rotate()", "hue-rotate($1)"],
284 | ["invert()", "invert($1)"],
285 | ["opacity()", "opacity($1)"],
286 | ["saturate()", "saturate($1)"],
287 | ["sepia()", "sepia($1)"],
288 | ],
289 | "font-variant-alternates": [
290 | "normal",
291 | "historical-forms",
292 | ["stylistic()", "stylistic($1)"],
293 | ["styleset()", "styleset($1)"],
294 | ["character-variant()", "character-variant($1)"],
295 | ["swash()", "swash($1)"],
296 | ["ornaments()", "ornaments($1)"],
297 | ["annotation()", "annotation($1)"],
298 | ],
299 | "generic-font-name": ["serif", "sans-serif", "cursive", "fantasy", "monospace"],
300 | "gradient": [
301 | ["conic-gradient()", "conic-gradient($1)"],
302 | ["linear-gradient()", "linear-gradient($1)"],
303 | ["radial-gradient()", "radial-gradient($1)"],
304 | ["repeating-conic-gradient()", "repeating-conic-gradient($1)"],
305 | ["repeating-linear-gradient()", "repeating-linear-gradient($1)"],
306 | ["repeating-radial-gradient()", "repeating-radial-gradient($1)"],
307 | ],
308 | "grid": [
309 | ["repeat()", "repeat(${1:2}, ${2:1fr})"],
310 | ["minmax()", "minmax(${1:100px}, ${2:1fr})"],
311 | ],
312 | "image": [
313 | "",
314 | ["image()", "image($1)"],
315 | ["image-set()", "image-set($1)"],
316 | ["element()", "element($1)"],
317 | ["paint()", "paint($1)"],
318 | ["cross-fade()", "cross-fade($1)"],
319 | ["linear-gradient()", "linear-gradient($1)"],
320 | ["repeating-linear-gradient()", "repeating-linear-gradient($1)"],
321 | ["radial-gradient()", "radial-gradient($1)"],
322 | ["repeating-radial-gradient()", "repeating-radial-gradient($1)"],
323 | ["conic-gradient()", "conic-gradient($1)"],
324 | ],
325 | "image-tags": ["ltr", "rtl"],
326 | "line-style": [
327 | "none",
328 | "hidden",
329 | "dotted",
330 | "dashed",
331 | "solid",
332 | "double",
333 | "groove",
334 | "ridge",
335 | "inset",
336 | "outset",
337 | ],
338 | "leader-type": ["dotted", "solid", "space"],
339 | "list-style-type": [
340 | "none",
341 | "inline",
342 | "disc",
343 | "circle",
344 | "square",
345 | "decimal",
346 | "decimal-leading-zero",
347 | "arabic-indic",
348 | "binary",
349 | "bengali",
350 | "cambodian",
351 | "khmer",
352 | "devanagari",
353 | "gujarati",
354 | "gurmukhi",
355 | "kannada",
356 | "lower-hexadecimal",
357 | "lao",
358 | "malayalam",
359 | "mongolian",
360 | "myanmar",
361 | "octal",
362 | "oriya",
363 | "persian",
364 | "urdu",
365 | "telugu",
366 | "tibetan",
367 | "thai",
368 | "upper-hexadecimal",
369 | "lower-roman",
370 | "upper-roman",
371 | "lower-greek",
372 | "lower-alpha",
373 | "lower-latin",
374 | "upper-alpha",
375 | "upper-latin",
376 | "afar",
377 | "ethiopic-halehame-aa-et",
378 | "ethiopic-halehame-aa-er",
379 | "amharic",
380 | "ethiopic-halehame-am-et",
381 | "amharic-abegede",
382 | "ethiopic-abegede-am-et",
383 | "cjk-earthly-branch",
384 | "cjk-heavenly-stem",
385 | "ethiopic",
386 | "ethiopic-halehame-gez",
387 | "ethiopic-abegede",
388 | "ethiopic-abegede-gez",
389 | "hangul-consonant",
390 | "hangul",
391 | "lower-norwegian",
392 | "oromo",
393 | "ethiopic-halehame-om-et",
394 | "sidama",
395 | "ethiopic-halehame-sid-et",
396 | "somali",
397 | "ethiopic-halehame-so-et",
398 | "tigre",
399 | "ethiopic-halehame-tig",
400 | "tigrinya-er",
401 | "ethiopic-halehame-ti-er",
402 | "tigrinya-er-abegede",
403 | "ethiopic-abegede-ti-er",
404 | "tigrinya-et",
405 | "ethiopic-halehame-ti-et",
406 | "tigrinya-et-abegede",
407 | "ethiopic-abegede-ti-et",
408 | "upper-greek",
409 | "upper-norwegian",
410 | "asterisks",
411 | "footnotes",
412 | "hebrew",
413 | "armenian",
414 | "lower-armenian",
415 | "upper-armenian",
416 | "georgian",
417 | "cjk-ideographic",
418 | "hiragana",
419 | "katakana",
420 | "hiragana-iroha",
421 | "katakana-iroha",
422 | ],
423 | "overflow-position": ["unsafe", "safe"],
424 | "position": ["", "center"],
425 | "relative-size": ["larger", "smaller"],
426 | "relative-weight": ["bolder", "lighter"],
427 | "repeat-style": [
428 | "repeat",
429 | "repeat-x",
430 | "repeat-y",
431 | "space",
432 | "round",
433 | "no-repeat",
434 | ],
435 | "scroller": ["root", "nearest"],
436 | "self-position": [
437 | "center",
438 | "start",
439 | "end",
440 | "self-start",
441 | "self-end",
442 | "flex-start",
443 | "flex-end",
444 | ],
445 | "shape-radius": ["closest-side", "farthest-side"],
446 | "side-or-corner": ["left", "right", "top", "bottom"],
447 | "text-wrap": ["wrap", "nowrap", "balance", "stable", "pretty"],
448 | "timing-function": [
449 | "linear",
450 | "ease",
451 | "ease-in",
452 | "ease-out",
453 | "ease-in-out",
454 | "step-start",
455 | "step-end",
456 | ["cubic-bezier()", "cubic-bezier(${1:0.0}, ${2:0.0}, ${3:1.0}, ${4:1.0})"],
457 | ["steps()", "steps(${1:2}, ${2:start})"],
458 | ],
459 | "type-or-unit": [
460 | "string",
461 | "color",
462 | "url",
463 | "integer",
464 | "number",
465 | "length",
466 | "angle",
467 | "time",
468 | "frequency",
469 | "cap",
470 | "ch",
471 | "em",
472 | "ex",
473 | "ic",
474 | "lh",
475 | "rlh",
476 | "rem",
477 | "vb",
478 | "vi",
479 | "vw",
480 | "vh",
481 | "vmin",
482 | "vmax",
483 | "mm",
484 | "Q",
485 | "cm",
486 | "in",
487 | "pt",
488 | "pc",
489 | "px",
490 | "deg",
491 | "grad",
492 | "rad",
493 | "turn",
494 | "ms",
495 | "s",
496 | "Hz",
497 | "kHz",
498 | "%",
499 | ],
500 | "url": [["url()", "url($1)"]],
501 | "white-space-collapse": [
502 | "collapse",
503 | "discard",
504 | "preserve",
505 | "preserve-breaks",
506 | "preserve-spaces",
507 | "break-spaces"
508 | ],
509 | "white-space-trim": [
510 | "none",
511 | "discard-before",
512 | "discard-after",
513 | "discard-inner"
514 | ],
515 | }
516 |
517 | resolved_values = {}
518 |
519 | def resolve(vals):
520 | vals_resolved = []
521 | for val in vals:
522 | if val[0] == "<" and val[-1] == ">":
523 | key = val[1:-1]
524 | resolved = resolved_values.get(key)
525 | if resolved:
526 | vals_resolved += resolved
527 | continue
528 | resolved = common_values.get(key)
529 | if resolved:
530 | vals_resolved += resolve(resolved)
531 | continue
532 |
533 | vals_resolved.append(val)
534 | return vals_resolved
535 |
536 | for val_key, val_vals in common_values.items():
537 | resolved_values[val_key] = resolve(val_vals)
538 |
539 | return resolved_values
540 |
--------------------------------------------------------------------------------
/plugins/completions/function_args.py:
--------------------------------------------------------------------------------
1 | from .common import get_common_values
2 |
3 |
4 | def get_func_args():
5 | common_values = get_common_values()
6 | func_args = {
7 | "abs": [""],
8 | "asin": [""],
9 | "atan": [""],
10 | "atan2": [""],
11 | "attr": ["", ""],
12 | "blur": [""],
13 | "brightness": [""],
14 | "calc": [["attr()", "attr($1)"], ""],
15 | "circle": ["", "", "at", ""],
16 | "clamp": [["attr()", "attr($1)"], ""],
17 | "conic-gradient": ["from", "at", "", ""],
18 | "cos": [""],
19 | "contrast": [],
20 | "counter": [""],
21 | "counters": [""],
22 | "cross-fade": ["", ""],
23 | "cubic-bezier": [""],
24 | "drop-shadow": ["", ""],
25 | "element": [],
26 | "ellipse": ["", "", "at", ""],
27 | "env": [],
28 | "exp": [""],
29 | "filter": ["", ""],
30 | "fit-content": [],
31 | "grayscale": [""],
32 | "hsl": [""],
33 | "hsla": [""],
34 | "hwb": ["", "none"],
35 | "hue-rotate": [""],
36 | "hypot": [""],
37 | "image": ["", "", ""],
38 | "image-set": [["type()", "type($1)"], "", ""],
39 | "inset": ["", "round"],
40 | "invert": [""],
41 | "lab": ["", "none"],
42 | "lch": ["", "none"],
43 | "leader": [""],
44 | "light-dark": [""],
45 | "linear-gradient": ["", "", "to"],
46 | "log": [""],
47 | "matrix": [""],
48 | "matrix3d": [""],
49 | "max": [["attr()", "attr($1)"], ""],
50 | "min": [["attr()", "attr($1)"], ""],
51 | "minmax": ["min-content", "max-content", "auto"],
52 | "mod": [""],
53 | "oklab": ["", "none"],
54 | "oklch": ["", "none"],
55 | "opacity": [""],
56 | "path": [""],
57 | "paint": [],
58 | "perspective": [""],
59 | "polygon": ["", ""],
60 | "pow": [""],
61 | "radial-gradient": ["", "", "at", "", ""],
62 | "rect": ["", "auto"],
63 | "rem": [""],
64 | "repeat": ["", "auto-fill", "auto-fit"],
65 | "repeating-conic-gradient": ["from", "at", "", ""],
66 | "repeating-linear-gradient": ["", "", "to"],
67 | "repeating-radial-gradient": [
68 | "",
69 | "",
70 | "at",
71 | "",
72 | "",
73 | ],
74 | "rgb": [""],
75 | "rgba": [""],
76 | "rotate": [""],
77 | "rotate3d": [""],
78 | "rotateX": [""],
79 | "rotateY": [""],
80 | "rotateZ": [""],
81 | "round": ["", "nearest", "up", "down", "to-zero"],
82 | "saturate": [""],
83 | "scale": [""],
84 | "scale3d": [""],
85 | "scaleX": [""],
86 | "scaleY": [""],
87 | "scaleZ": [""],
88 | "scroll": ["", ""],
89 | "skew": [""],
90 | "skewX": [""],
91 | "skewY": [""],
92 | "sepia": [""],
93 | "sign": [""],
94 | "sin": [""],
95 | "sqrt": [""],
96 | "steps": ["", "end", "middle", "start"],
97 | "tan": [""],
98 | "target-counter": ["", ""],
99 | "target-counters": ["", ""],
100 | "target-text": ["", "content", "before", "after", "first-letter"],
101 | "toggle": ["", ""],
102 | "translate": [""],
103 | "translate3d": [""],
104 | "translateX": [""],
105 | "translateY": [""],
106 | "translateZ": [""],
107 | "var": [],
108 | }
109 |
110 | completions = {}
111 |
112 | for func, args in func_args.items():
113 | # args that are allowed for all properties
114 | expanded_args = [["var()", "var($1)"]]
115 |
116 | # Determine which args are available for the current property name
117 | for arg in args:
118 | if arg[0] == "<" and arg[-1] == ">":
119 | key = arg[1:-1]
120 | if key in common_values:
121 | expanded_args += common_values[key]
122 | else:
123 | expanded_args.append(arg)
124 |
125 | completions[func] = expanded_args
126 |
127 | return completions
128 |
--------------------------------------------------------------------------------
/plugins/completions/properties.py:
--------------------------------------------------------------------------------
1 | from .common import get_common_values
2 |
3 |
4 | def get_properties():
5 | """
6 | Gets the properties.
7 |
8 | Prepare some common property values for when there is more than one way to
9 | specify a certain value type. The color value for example can be specified
10 | by `rgb()` or `hsl()` and so on. Example where `|` denotes the caret:
11 |
12 | color: rg| --> color: rgb(|);
13 |
14 | This is also helpful when multiple properties share the same value types.
15 | """
16 | common_values = get_common_values()
17 | properties_dict = {
18 | "accent-color": ["auto", "", ""],
19 | "additive-symbols": [],
20 | "align-content": [
21 | "normal",
22 | "",
23 | "",
24 | "",
25 | "",
26 | ],
27 | "align-items": [
28 | "normal",
29 | "stretch",
30 | "",
31 | "",
32 | "",
33 | ],
34 | "align-self": [
35 | "auto",
36 | "normal",
37 | "stretch",
38 | "",
39 | "",
40 | "",
41 | ],
42 | "align-tracks": [
43 | "normal",
44 | "",
45 | "",
46 | "",
47 | "",
48 | ],
49 | "all": [],
50 | "alt": [],
51 | "animation": [
52 | "",
53 | "",
54 | "",
55 | "none",
56 | "infinite",
57 | "forwards",
58 | "backwards",
59 | "both",
60 | "running",
61 | "paused",
62 | ],
63 | "animation-delay": [""],
64 | "animation-direction": [""],
65 | "animation-duration": [""],
66 | "animation-fill-mode": ["none", "forwards", "backwards", "both"],
67 | "animation-iteration-count": [
68 | "",
69 | "infinite",
70 | ],
71 | "animation-name": [
72 | "none",
73 | ],
74 | "animation-play-state": ["running", "paused"],
75 | "animation-timing-function": ["", ""],
76 | "animation-timeline": [
77 | "auto",
78 | "none",
79 | ["scroll()", "scroll($1)"]
80 | ],
81 | "appearance": ["auto", "menulist-button", "none", "textfield"],
82 | "aspect-ratio": ["auto"],
83 | "azimuth": [
84 | "",
85 | "behind",
86 | "center",
87 | "center-left",
88 | "center-right",
89 | "far-left",
90 | "far-right",
91 | "left",
92 | "left-side",
93 | "leftwards",
94 | "right",
95 | "right-side",
96 | "rightwards",
97 | ],
98 | "backdrop-filter": ["none", "", ""],
99 | "backface-visibility": ["visible", "hidden"],
100 | "background": [
101 | "",
102 | "",
103 | "",
104 | "",
105 | "",
106 | "",
107 | "fixed",
108 | "scroll",
109 | ],
110 | "background-attachment": ["fixed", "local", "scroll"],
111 | "background-blend-mode": [""],
112 | "background-clip": [
113 | "border-box",
114 | "content-box",
115 | "padding-box",
116 | ],
117 | "background-color": [""],
118 | "background-image": ["", "none"],
119 | "background-origin": [
120 | "border-box",
121 | "content-box",
122 | "padding-box",
123 | ],
124 | "background-position": ["", ""],
125 | "background-position-x": [
126 | "",
127 | "center",
128 | "left",
129 | "right",
130 | "x-end",
131 | "x-start",
132 | ],
133 | "background-position-y": [
134 | "",
135 | "bottom",
136 | "center",
137 | "top",
138 | "y-end",
139 | "y-start",
140 | ],
141 | "background-repeat": [""],
142 | "background-size": [
143 | "",
144 | "auto",
145 | "cover",
146 | "contain",
147 | ],
148 | "behavior": [],
149 | "bleed": ["auto"],
150 | "block-size": ["", "auto"],
151 | "border": ["", "", "", ""],
152 | "border-block": ["", "", "", ""],
153 | "border-block-color": [""],
154 | "border-block-end": ["", "", "", ""],
155 | "border-block-end-color": [""],
156 | "border-block-end-style": [""],
157 | "border-block-end-width": ["", ""],
158 | "border-block-start": ["", "", "", ""],
159 | "border-block-start-color": [""],
160 | "border-block-start-style": [""],
161 | "border-block-start-width": ["", ""],
162 | "border-block-style": [""],
163 | "border-block-width": ["", ""],
164 | "border-bottom": ["", "", "", ""],
165 | "border-bottom-color": [""],
166 | "border-bottom-left-radius": [""],
167 | "border-bottom-right-radius": [""],
168 | "border-bottom-style": [""],
169 | "border-bottom-width": ["", ""],
170 | "border-collapse": ["collapse", "separate"],
171 | "border-color": [""],
172 | "border-end-end-radius": [""],
173 | "border-end-start-radius": [""],
174 | "border-image": [
175 | "",
176 | "",
177 | "auto",
178 | "fill",
179 | "none",
180 | "repeat",
181 | "round",
182 | "space",
183 | "stretch",
184 | ],
185 | "border-image-outset": [],
186 | "border-image-repeat": ["stretch", "repeat", "round", "space"],
187 | "border-image-slice": [
188 | "",
189 | "fill",
190 | ],
191 | "border-image-source": ["none", ""],
192 | "border-image-width": ["", "auto"],
193 | "border-inline": ["", "", "", ""],
194 | "border-inline-color": [""],
195 | "border-inline-end": ["", "", "", ""],
196 | "border-inline-end-color": [""],
197 | "border-inline-end-style": [""],
198 | "border-inline-end-width": ["", ""],
199 | "border-inline-start": [
200 | "",
201 | "",
202 | "",
203 | "",
204 | ],
205 | "border-inline-start-color": [""],
206 | "border-inline-start-style": [""],
207 | "border-inline-start-width": ["", ""],
208 | "border-inline-style": [""],
209 | "border-inline-width": ["", ""],
210 | "border-left": ["", "", "", ""],
211 | "border-left-color": [""],
212 | "border-left-style": [""],
213 | "border-left-width": ["", ""],
214 | "border-radius": [""],
215 | "border-right": ["", "", "", ""],
216 | "border-right-color": [""],
217 | "border-right-style": [""],
218 | "border-right-width": ["", ""],
219 | "border-spacing": [],
220 | "border-start-end-radius": [""],
221 | "border-start-start-radius": [""],
222 | "border-style": [""],
223 | "border-top": ["", "", "", "