├── .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": ["", "", "", ""], 224 | "border-top-color": [""], 225 | "border-top-left-radius": [""], 226 | "border-top-right-radius": [""], 227 | "border-top-style": [""], 228 | "border-top-width": ["", ""], 229 | "border-width": ["", ""], 230 | "bottom": ["", "auto"], 231 | "box-align": ["baseline", "center", "end", "start", "stretch"], 232 | "box-decoration-break": ["slice", "clone"], 233 | "box-direction": ["normal", "reverse"], 234 | "box-flex": [""], 235 | "box-flex-group": [""], 236 | "box-lines": ["multiple", "single"], 237 | "box-ordinal-group": [""], 238 | "box-orient": ["block-axis", "horizontal", "inline-axis", "vertical"], 239 | "box-pack": ["center", "end", "justify", "start"], 240 | "box-shadow": ["none", "inset", "", ""], 241 | "box-sizing": ["content-box", "border-box"], 242 | "break-after": ["", ""], 243 | "break-before": ["", ""], 244 | "break-inside": [""], 245 | "caption-side": ["top", "bottom"], 246 | "caret": ["", ""], 247 | "caret-color": [""], 248 | "caret-shape": [""], 249 | "clear": ["none", "left", "right", "both"], 250 | "clip": [["rect()", "rect(${1:0}, ${2:0}, ${3:0}, ${4:0})"], "auto"], 251 | "clip-path": ["none", "", ""], 252 | "clip-rule": ["nonzero", "evenodd"], 253 | "color": [""], 254 | "color-interpolation": ["auto", "sRGB", "linearRGB"], 255 | "color-interpolation-filters": ["auto", "sRGB", "linearRGB"], 256 | "color-scheme": ["normal", "light", "dark", "only"], 257 | "column-count": [ 258 | "", 259 | "auto", 260 | ], 261 | "column-fill": ["auto", "balance"], 262 | "column-gap": [ 263 | "", 264 | "normal", 265 | ], 266 | "column-rule": ["", "", "", ""], 267 | "column-rule-color": [""], 268 | "column-rule-style": [""], 269 | "column-rule-width": ["", ""], 270 | "column-span": ["", "none"], 271 | "column-width": [ 272 | "", 273 | "auto", 274 | ], 275 | "columns": ["", "auto"], 276 | "container": [""], 277 | "container-name": ["none"], 278 | "container-type": [""], 279 | "contain": ["content", "layout", "none", "paint", "inline-size", "size", "strict", "style"], 280 | "contain-intrinsic-size": ["none", "auto"], 281 | "contain-intrinsic-block-size": ["none", "auto"], 282 | "contain-intrinsic-height": ["none", "auto"], 283 | "contain-intrinsic-inline-size": ["none", "auto"], 284 | "contain-intrinsic-width": ["none", "auto"], 285 | "content": [ 286 | "none", 287 | "normal", 288 | "", 289 | "", 290 | "open-quote", 291 | "close-quote", 292 | "no-open-quote", 293 | "no-close-quote", 294 | ["attr()", "attr($1)"], 295 | ["counter()", "counter($1)"], 296 | ], 297 | "content-visibility": ["auto", "hidden", "visible"], 298 | "counter-increment": [ 299 | "", 300 | "none", 301 | ], 302 | "counter-reset": [ 303 | "none", 304 | ], 305 | "counter-set": ["", "none"], 306 | "cursor": [ 307 | "", 308 | "auto", 309 | "default", 310 | "none", 311 | "context-menu", 312 | "help", 313 | "pointer", 314 | "progress", 315 | "wait", 316 | "cell", 317 | "crosshair", 318 | "text", 319 | "vertical-text", 320 | "alias", 321 | "copy", 322 | "move", 323 | "no-drop", 324 | "not-allowed", 325 | "e-resize", 326 | "n-resize", 327 | "ne-resize", 328 | "nw-resize", 329 | "s-resize", 330 | "se-resize", 331 | "sw-resize", 332 | "w-resize", 333 | "ew-resize", 334 | "ns-resize", 335 | "nesw-resize", 336 | "nwse-resize", 337 | "col-resize", 338 | "row-resize", 339 | "all-scroll", 340 | "zoom-in", 341 | "zoom-out", 342 | ], 343 | "direction": ["ltr", "rtl"], 344 | "display": [ 345 | "none", 346 | "inline", 347 | "inline-block", 348 | "inline-table", 349 | "inline-flex", 350 | "inline-grid", 351 | "block", 352 | "contents", 353 | "list-item", 354 | "table", 355 | "table-cell", 356 | "table-column", 357 | "table-column-group", 358 | "table-footer-group", 359 | "table-header-group", 360 | "table-row", 361 | "table-row-group", 362 | "table-caption", 363 | "flex", 364 | "flow", 365 | "flow-root", 366 | "grid", 367 | "ruby", 368 | "ruby-base", 369 | "ruby-text", 370 | "ruby-base-container", 371 | "ruby-text-container", 372 | "run-in", 373 | ], 374 | "empty-cells": ["show", "hide"], 375 | "enable-background": ["accumulate", "new"], 376 | "fallback": [], 377 | "fill": [""], 378 | "fill-opacity": [ 379 | "", 380 | ], 381 | "fill-rule": ["nonzero", "evenodd"], 382 | "filter": [ 383 | "", 384 | ["blur()", "blur(${1:5px})"], 385 | ["brightness()", "brightness(${1:1.0})"], 386 | ["contrast()", "contrast(${1:100%})"], 387 | ["drop-shadow()", "drop-shadow(${1:1px} ${2:1px})"], 388 | ["grayscale()", "grayscale(${1:50%})"], 389 | ["hue-rotate()", "hue-rotate(${1:90deg})"], 390 | ["invert()", "invert(${1:50%})"], 391 | ["opacity()", "opacity(${1:100%})"], 392 | ["saturate()", "saturate(${1:50%})"], 393 | ["sepia()", "sepia(${1:50%})"], 394 | ], 395 | "flex": [ 396 | "", 397 | "none", 398 | "auto", 399 | ], 400 | "flex-basis": [ 401 | "", 402 | "auto", 403 | ], 404 | "flex-direction": ["row", "row-reverse", "column", "column-reverse"], 405 | "flex-flow": [ 406 | "row", 407 | "row-reverse", 408 | "column", 409 | "column-reverse", 410 | "nowrap", 411 | "wrap", 412 | "wrap-reverse", 413 | ], 414 | "flex-grow": [ 415 | "", 416 | ], 417 | "flex-shrink": [ 418 | "", 419 | ], 420 | "flex-wrap": ["nowrap", "wrap", "wrap-reverse"], 421 | "float": [ 422 | "left", 423 | "right", 424 | "none", 425 | "inline-start", 426 | "inline-end", 427 | ], 428 | "flood-color": [""], 429 | "flood-opacity": [ 430 | "", 431 | ], 432 | "font": [ 433 | "", 434 | "", 435 | "", 436 | "", 437 | "caption", 438 | "icon", 439 | "italic", 440 | "menu", 441 | "message-box", 442 | "oblique", 443 | "small-caps", 444 | "small-caption", 445 | "status-bar", 446 | ], 447 | "font-display": ["auto", "block", "fallback", "optional", "swap"], 448 | "font-family": [""], 449 | "font-feature-settings": ["normal", ""], 450 | "font-kerning": ["auto", "normal", "none"], 451 | "font-language-override": ["normal", ""], 452 | "font-optical-sizing": ["auto", "none"], 453 | "font-size": [ 454 | "", 455 | "", 456 | "", 457 | ], 458 | "font-size-adjust": [ 459 | "", 460 | "ex-height", 461 | "cap-height", 462 | "ch-width", 463 | "ic-width", 464 | "ic-height", 465 | "from-font", 466 | "none", 467 | ], 468 | "font-smooth": ["always", "auto", "never"], 469 | "font-stretch": [ 470 | "normal", 471 | "semi-condensed", 472 | "condensed", 473 | "extra-condensed", 474 | "ultra-condensed", 475 | "semi-expanded", 476 | "expanded", 477 | "extra-expanded", 478 | "ultra-expanded", 479 | ], 480 | "font-style": ["normal", "italic", "oblique"], 481 | "font-synthesis": ["none", "weight", "style", "small-caps"], 482 | "font-synthesis-small-caps": ["auto", "none"], 483 | "font-synthesis-style": ["auto", "none"], 484 | "font-synthesis-weight": ["auto", "none"], 485 | "font-variant": ["normal", "small-caps"], 486 | "font-variant-alternates": [""], 487 | "font-variant-caps": [ 488 | "normal", 489 | "small-caps", 490 | "all-small-caps", 491 | "petite-caps", 492 | "all-petite-caps", 493 | "unicase", 494 | "titling-case", 495 | ], 496 | "font-variant-east-asian": [ 497 | "normal", 498 | "ruby", 499 | "jis78", 500 | "jis83", 501 | "jis90", 502 | "jis04", 503 | "simplified", 504 | "traditional", 505 | ], 506 | "font-variant-emoji": ["normal", "text", "emoji", "unicode"], 507 | "font-variant-ligatures": [ 508 | "normal", 509 | "none", 510 | "common-ligatures", 511 | "no-common-ligatures", 512 | "discretionary-ligatures", 513 | "no-discretionary-ligatures", 514 | "historical-ligatures", 515 | "no-historical-ligatures", 516 | "contextual", 517 | "no-contextual", 518 | ], 519 | "font-variant-numeric": [ 520 | "normal", 521 | "ordinal", 522 | "slashed-zero", 523 | "lining-nums", 524 | "oldstyle-nums", 525 | "proportional-nums", 526 | "tabular-nums", 527 | "diagonal-fractions", 528 | "stacked-fractions", 529 | ], 530 | "font-variant-position": ["normal", "sub", "super"], 531 | "font-variation-settings": ["normal"], 532 | "font-weight": ["", ""], 533 | "forced-color-adjust": ["auto", "none"], 534 | "gap": [ 535 | "", 536 | ], 537 | "glyph-orientation-horizontal": ["auto"], 538 | "glyph-orientation-vertical": ["auto"], 539 | "grid": [ 540 | "", 541 | "", 542 | "auto", 543 | "auto-flow", 544 | "dense", 545 | "span", 546 | ], 547 | "grid-area": [ 548 | "", 549 | "", 550 | "auto", 551 | "span", 552 | ], 553 | "grid-auto-columns": [ 554 | "", 555 | "", 556 | "auto", 557 | ], 558 | "grid-auto-flow": ["row", "column", "dense"], 559 | "grid-auto-rows": [ 560 | "", 561 | "", 562 | "auto", 563 | ], 564 | "grid-column": [ 565 | "", 566 | "auto", 567 | "span", 568 | ], 569 | "grid-column-end": [ 570 | "", 571 | "auto", 572 | "span", 573 | ], 574 | "grid-column-gap": [ 575 | "", 576 | "auto", 577 | "span", 578 | ], 579 | "grid-column-start": [ 580 | "", 581 | "auto", 582 | "span", 583 | ], 584 | "grid-gap": [ 585 | "", 586 | ], 587 | "grid-row": [ 588 | "", 589 | "auto", 590 | "span", 591 | ], 592 | "grid-row-end": [ 593 | "", 594 | "auto", 595 | "span", 596 | ], 597 | "grid-row-gap": [ 598 | "", 599 | ], 600 | "grid-row-start": [ 601 | "", 602 | "auto", 603 | "span", 604 | ], 605 | "grid-template": [ 606 | "", 607 | "", 608 | "auto", 609 | "max-content", 610 | "min-content", 611 | "none", 612 | "subgrid", 613 | ], 614 | "grid-template-areas": [ 615 | "auto", 616 | "", 617 | "", 618 | ], 619 | "grid-template-columns": [ 620 | "auto", 621 | "", 622 | "", 623 | ], 624 | "grid-template-rows": [ 625 | "auto", 626 | "", 627 | "", 628 | ], 629 | "hanging-punctuation": ["allow-end", "first", "force-end", "last", "none"], 630 | "height": ["", "auto", "fit-content"], 631 | "hyphens": ["none", "manual", "auto"], 632 | "hyphenate-character": ["auto"], 633 | "hyphenate-limit-chars": ["auto"], 634 | "image-orientation": ["flip", "from-image"], 635 | "image-rendering": ["auto", "optimizeSpeed", "optimizeQuality", "pixelated"], 636 | "image-resolution": ["from-image"], 637 | "ime-mode": ["auto", "normal", "active", "inactive", "disabled"], 638 | "inherits": ["false", "true"], 639 | "initial-letter": ["normal"], 640 | "initial-letter-align": ["alphabetic", "auto", "hanging", "ideographic"], 641 | "initial-value": [ 642 | "", 643 | ], 644 | "inline-size": ["", "auto"], 645 | "input-security": ["auto", "none"], 646 | "inset": [], 647 | "inset-block": [], 648 | "inset-block-end": [], 649 | "inset-block-start": [], 650 | "inset-inline": [], 651 | "inset-inline-end": [], 652 | "inset-inline-start": [], 653 | "isolation": ["auto", "isolation"], 654 | "justify-content": [ 655 | "left", 656 | "normal", 657 | "right", 658 | "", 659 | "", 660 | "", 661 | ], 662 | "justify-items": [ 663 | "left", 664 | "legacy", 665 | "normal", 666 | "right", 667 | "stretch", 668 | "", 669 | "", 670 | "", 671 | ], 672 | "justify-self": [ 673 | "auto", 674 | "left", 675 | "normal", 676 | "right", 677 | "stretch", 678 | "", 679 | "", 680 | "", 681 | ], 682 | "justify-tracks": [ 683 | "left", 684 | "normal", 685 | "right", 686 | "", 687 | "", 688 | "", 689 | ], 690 | "kerning": ["", "auto"], 691 | "left": ["", "auto"], 692 | "letter-spacing": [ 693 | "", 694 | "normal", 695 | ], 696 | "lighting-color": [""], 697 | "line-break": ["anywhere", "auto", "loose", "normal", "strict"], 698 | "line-clamp": ["", "none"], 699 | "line-height": [ 700 | "", 701 | "normal", 702 | ], 703 | "line-height-step": [ 704 | "", 705 | ], 706 | "list-style": [ 707 | "", 708 | "", 709 | "inside", 710 | "outside", 711 | ], 712 | "list-style-image": ["", "none"], 713 | "list-style-position": ["inside", "outside"], 714 | "list-style-type": [""], 715 | "margin": [ 716 | "", 717 | "auto", 718 | ], 719 | "margin-block": [ 720 | "", 721 | ], 722 | "margin-block-end": ["", "auto"], 723 | "margin-block-start": ["", "auto"], 724 | "margin-bottom": [ 725 | "", 726 | "auto", 727 | ], 728 | "margin-inline": [ 729 | "", 730 | ], 731 | "margin-inline-end": ["", "auto"], 732 | "margin-inline-start": ["", "auto"], 733 | "margin-left": [ 734 | "", 735 | "auto", 736 | ], 737 | "margin-right": [ 738 | "", 739 | "auto", 740 | ], 741 | "margin-top": [ 742 | "", 743 | "auto", 744 | ], 745 | "margin-trim": ["all", "in-flow", "none"], 746 | "marker": ["", "none"], 747 | "marker-end": ["", "none"], 748 | "marker-mid": ["", "none"], 749 | "marker-start": ["", "none"], 750 | "marks": ["crop", "cross", "none"], 751 | "mask": ["", "", "none"], 752 | "mask-border": [ 753 | "", 754 | ], 755 | "mask-border-mode": ["alpha", "luminance"], 756 | "mask-border-outset": [], 757 | "mask-border-repeat": ["repeat", "round", "space", "stretch"], 758 | "mask-border-slice": [], 759 | "mask-border-source": ["none"], 760 | "mask-border-width": ["", "auto"], 761 | "mask-clip": ["no-clip"], 762 | "mask-composite": [], 763 | "mask-image": ["", "none"], 764 | "mask-mode": ["alpha", "auto", "luminance"], 765 | "mask-origin": [ 766 | "", 767 | ], 768 | "mask-position": [ 769 | "", 770 | ], 771 | "mask-repeat": [""], 772 | "mask-size": ["", "auto", "contain", "cover"], 773 | "mask-type": ["luminance", "alpha"], 774 | "masonry-auto-flow": ["definite-first", "next", "ordered", "pack"], 775 | "math-depth": ["auto-add", ["add()", "add($1)"]], 776 | "math-shift": ["compact", "normal"], 777 | "math-style": ["compact", "normal"], 778 | "max-block-size": ["", "none"], 779 | "max-height": ["", "fit-content", "none"], 780 | "max-inline-size": ["", "none"], 781 | "max-lines": ["", "none"], 782 | "max-width": ["", "fit-content", "none"], 783 | "max-zoom": ["", "auto"], 784 | "min-block-size": [ 785 | "", 786 | ], 787 | "min-height": ["", "fit-content"], 788 | "min-inline-size": [ 789 | "", 790 | ], 791 | "min-width": ["", "fit-content"], 792 | "min-zoom": ["", "auto"], 793 | "mix-blend-mode": ["", "plus-lighter"], 794 | "motion": [["path()", "path($1)"], "auto", "none", "reverse"], 795 | "motion-offset": [ 796 | "", 797 | ], 798 | "motion-path": [["path()", "path($1)"], "none"], 799 | "motion-rotation": ["auto", "reverse"], 800 | "nav-down": ["auto", "current", "root"], 801 | "nav-index": ["auto"], 802 | "nav-left": ["auto", "current", "root"], 803 | "nav-right": ["auto", "current", "root"], 804 | "nav-up": ["auto", "current", "root"], 805 | "negative": [], 806 | "object-fit": ["fill", "contain", "cover", "none", "scale-down"], 807 | "object-position": ["", ""], 808 | "offset": [ 809 | "", 810 | ], 811 | "offset-anchor": ["", "auto"], 812 | "offset-block-end": ["", "auto"], 813 | "offset-block-start": ["", "auto"], 814 | "offset-distance": [ 815 | "", 816 | ], 817 | "offset-inline-end": ["", "auto"], 818 | "offset-inline-start": ["", "auto"], 819 | "offset-path": ["", "none"], 820 | "offset-position": ["", "auto", "normal"], 821 | "offset-rotate": ["", "auto", "reverse"], 822 | "opacity": [ 823 | "", 824 | ], 825 | "order": [], 826 | "orientation": ["auto", "landscape", "portrait"], 827 | "orphans": [], 828 | "outline": [ 829 | "", 830 | "", 831 | "", 832 | "", 833 | ], 834 | "outline-color": ["", "invert"], 835 | "outline-offset": [""], 836 | "outline-style": [""], 837 | "outline-width": [ 838 | "", 839 | "", 840 | ], 841 | "overflow": ["visible", "hidden", "scroll", "auto"], 842 | "overflow-anchor": ["auto", "none"], 843 | "overflow-block": ["auto", "clip", "hidden", "scroll", "visible"], 844 | "overflow-clip-box": ["content-box", "padding-box"], 845 | "overflow-inline": ["auto", "clip", "hidden", "scroll", "visible"], 846 | "overflow-wrap": ["normal", "break-word"], 847 | "overflow-x": ["visible", "hidden", "scroll", "auto"], 848 | "overflow-y": ["visible", "hidden", "scroll", "auto"], 849 | "overscroll-behavior": ["auto", "contain", "none"], 850 | "overscroll-behavior-block": ["auto", "contain", "none"], 851 | "overscroll-behavior-inline": ["auto", "contain", "none"], 852 | "overscroll-behavior-x": ["auto", "contain", "none"], 853 | "overscroll-behavior-y": ["auto", "contain", "none"], 854 | "pad": [ 855 | "", 856 | ], 857 | "padding": ["", "auto"], 858 | "padding-block": [ 859 | "", 860 | ], 861 | "padding-block-end": [ 862 | "", 863 | ], 864 | "padding-block-start": [ 865 | "", 866 | ], 867 | "padding-bottom": ["", "auto"], 868 | "padding-inline": [ 869 | "", 870 | ], 871 | "padding-inline-end": [ 872 | "", 873 | ], 874 | "padding-inline-start": [ 875 | "", 876 | ], 877 | "padding-left": ["", "auto"], 878 | "padding-right": ["", "auto"], 879 | "padding-top": ["", "auto"], 880 | "page": ["auto"], 881 | "page-break-after": ["auto", "always", "avoid", "left", "right"], 882 | "page-break-before": ["auto", "always", "avoid", "left", "right"], 883 | "page-break-inside": ["avoid", "auto"], 884 | "page-orientation": ["upright", "rotate-left", "rotate-right"], 885 | "paint-order": ["normal", "fill", "stroke", "markers"], 886 | "perspective": ["none"], 887 | "perspective-origin": ["", ""], 888 | "place-content": [], 889 | "place-items": [], 890 | "place-self": [], 891 | "pointer-events": [ 892 | "auto", 893 | "none", 894 | "all", 895 | "visiblePainted", 896 | "visibleFill", 897 | "visibleStroke", 898 | "visible", 899 | "painted", 900 | "fill", 901 | "stroke", 902 | ], 903 | "position": ["static", "relative", "absolute", "fixed", "sticky"], 904 | "prefix": [], 905 | "print-color-adjust": ["economy", "exact"], 906 | "quotes": ["none", ""], 907 | "range": ["auto", "infinite"], 908 | "resize": ["none", "both", "horizontal", "vertical"], 909 | "right": ["", "auto"], 910 | "rotate": ["", "none"], 911 | "row-gap": ["", "normal"], 912 | "ruby-align": [ 913 | "auto", 914 | "center", 915 | "distribute-letter", 916 | "distribute-space", 917 | "left", 918 | "line-edge", 919 | "right", 920 | "space-around", 921 | "space-between", 922 | "start", 923 | ], 924 | "ruby-merge": ["auto", "collapse", "separate"], 925 | "ruby-overhang": ["auto", "end", "none", "start"], 926 | "ruby-position": [ 927 | "after", 928 | "before", 929 | "inline", 930 | "inter-character", 931 | "over", 932 | "right", 933 | "under", 934 | ], 935 | "ruby-span": [["attr()", "attr($1)"], "", "none"], 936 | "scale": ["", "none"], 937 | "scroll-behavior": ["auto", "smooth"], 938 | "scroll-margin": [""], 939 | "scroll-margin-block": [""], 940 | "scroll-margin-block-end": [""], 941 | "scroll-margin-block-start": [""], 942 | "scroll-margin-bottom": [""], 943 | "scroll-margin-inline": [""], 944 | "scroll-margin-inline-end": [""], 945 | "scroll-margin-inline-start": [""], 946 | "scroll-margin-left": [""], 947 | "scroll-margin-right": [""], 948 | "scroll-margin-top": [""], 949 | "scroll-padding": ["auto", ""], 950 | "scroll-padding-block": ["auto", ""], 951 | "scroll-padding-block-end": ["auto", ""], 952 | "scroll-padding-block-start": ["auto", ""], 953 | "scroll-padding-bottom": ["auto", ""], 954 | "scroll-padding-inline": ["auto", ""], 955 | "scroll-padding-inline-end": ["auto", ""], 956 | "scroll-padding-inline-start": ["auto", ""], 957 | "scroll-padding-left": ["auto", ""], 958 | "scroll-padding-right": ["auto", ""], 959 | "scroll-padding-top": ["auto", ""], 960 | "scroll-snap-align": ["center", "end", "none", "start"], 961 | "scroll-snap-coordinate": ["none"], 962 | "scroll-snap-destination": [], 963 | "scroll-snap-points-x": [["repeat()", "repeat($1)"], "none"], 964 | "scroll-snap-points-y": [["repeat()", "repeat($1)"], "none"], 965 | "scroll-snap-stop": ["always", "normal"], 966 | "scroll-snap-type": [ 967 | "block", 968 | "both", 969 | "inline", 970 | "mandatory", 971 | "none", 972 | "proximity", 973 | ], 974 | "scroll-snap-type-x": ["mandatory", "none", "proximity"], 975 | "scroll-snap-type-y": ["mandatory", "none", "proximity"], 976 | "scroll-timeline": ["none", ""], 977 | "scroll-timeline-axis": [""], 978 | "scroll-timeline-name": ["none"], 979 | "scrollbar-3dlight-color": [""], 980 | "scrollbar-arrow-color": [""], 981 | "scrollbar-base-color": [""], 982 | "scrollbar-color": ["auto", "dark", "light", ""], 983 | "scrollbar-darkshadow-color": [""], 984 | "scrollbar-face-color": [""], 985 | "scrollbar-gutter": ["always", "auto", "stable"], 986 | "scrollbar-highlight-color": [""], 987 | "scrollbar-shadow-color": [""], 988 | "scrollbar-track-color": [""], 989 | "scrollbar-width": ["auto", "none", "thin", ""], 990 | "shape-image-threshold": [], 991 | "shape-margin": [""], 992 | "shape-outside": [ 993 | "none", 994 | "margin-box", 995 | "content-box", 996 | "border-box", 997 | "padding-box", 998 | "", 999 | "", 1000 | ], 1001 | "shape-rendering": [ 1002 | "auto", 1003 | "optimizeSpeed", 1004 | "crispEdges", 1005 | "geometricPrecision", 1006 | ], 1007 | "size": [ 1008 | "a3", 1009 | "a4", 1010 | "a5", 1011 | "b4", 1012 | "b5", 1013 | "jis-b4", 1014 | "jis-b5", 1015 | "landscape", 1016 | "ledger", 1017 | "legal", 1018 | "letter", 1019 | "portrait", 1020 | ], 1021 | "speak-as": ["auto", "bullets", "numbers", "spell-out", "words"], 1022 | "src": [["format()", "format($1)"], ["local()", "local($1)"], ""], 1023 | "stop-color": [""], 1024 | "stop-opacity": [""], 1025 | "stroke": ["", ""], 1026 | "stroke-dasharray": ["none"], 1027 | "stroke-dashoffset": [], 1028 | "stroke-linecap": ["butt", "round", "square"], 1029 | "stroke-linejoin": ["round", "miter", "bevel"], 1030 | "stroke-miterlimit": [""], 1031 | "stroke-opacity": [""], 1032 | "stroke-width": [""], 1033 | "suffix": [], 1034 | "symbols": [], 1035 | "syntax": [], 1036 | "system": [""], 1037 | "tab-size": [""], 1038 | "table-layout": ["auto", "fixed"], 1039 | "text-align": ["left", "right", "center", "justify", "justify-all"], 1040 | "text-align-last": ["start", "end", "left", "right", "center", "justify"], 1041 | "text-anchor": ["start", "middle", "end"], 1042 | "text-combine-upright": ["all", "digits", "none"], 1043 | "text-decoration": ["none", "underline", "overline", "line-through", "blink"], 1044 | "text-decoration-color": [""], 1045 | "text-decoration-line": ["none", "underline", "overline", "line-through"], 1046 | "text-decoration-skip": [ 1047 | "box-decoration", 1048 | "edges", 1049 | "leading-spaces", 1050 | "none", 1051 | "objects", 1052 | "spaces", 1053 | "trailing-spaces", 1054 | ], 1055 | "text-decoration-skip-ink": ["all", "auto", "none"], 1056 | "text-decoration-style": ["solid", "double", "dotted", "dashed", "wavy"], 1057 | "text-decoration-thickness": ["auto", "from-font"], 1058 | "text-emphasis": [ 1059 | "", 1060 | "", 1061 | "", 1062 | ], 1063 | "text-emphasis-color": [ 1064 | "", 1065 | ], 1066 | "text-emphasis-position": ["left", "over", "right", "under"], 1067 | "text-emphasis-style": ["", ""], 1068 | "text-indent": ["", "hanging", "each-line"], 1069 | "text-justify": [ 1070 | "auto", 1071 | "distribute", 1072 | "distribute-all-lines", 1073 | "inter-character", 1074 | "inter-cluster", 1075 | "inter-ideograph", 1076 | "inter-word", 1077 | "kashida", 1078 | "newspaper", 1079 | "none", 1080 | ], 1081 | "text-orientation": ["mixed", "upright", "sideways", "use-glyph-orientation"], 1082 | "text-overflow": ["", "clip", "ellipsis"], 1083 | "text-rendering": [ 1084 | "auto", 1085 | "optimizeSpeed", 1086 | "optimizeLegibility", 1087 | "geometricPrecision", 1088 | ], 1089 | "text-shadow": ["", "none"], 1090 | "text-size-adjust": ["", "auto", "none"], 1091 | "text-transform": [ 1092 | "capitalize", 1093 | "full-size-kana", 1094 | "full-width", 1095 | "uppercase", 1096 | "lowercase", 1097 | "none", 1098 | ], 1099 | "text-underline-offset": ["", "auto"], 1100 | "text-underline-position": ["auto", "under", "left", "right"], 1101 | "text-wrap": [""], 1102 | "top": ["", "auto"], 1103 | "touch-action": [ 1104 | "auto", 1105 | "cross-slide-x", 1106 | "cross-slide-y", 1107 | "double-tap-zoom", 1108 | "manipulation", 1109 | "none", 1110 | "pan-down", 1111 | "pan-left", 1112 | "pan-right", 1113 | "pan-up", 1114 | "pan-x", 1115 | "pan-y", 1116 | "pinch-zoom", 1117 | ], 1118 | "transform": [ 1119 | "none", 1120 | ["matrix()", "matrix(${1:1}, ${2:1}, ${3:1}, ${4:1}, ${5:2}, ${6:2})"], 1121 | [ 1122 | "matrix3d()", 1123 | "matrix3d(${1:1}, ${2:1}, ${3:0}, ${4:0}, ${5:1}, ${6:1}, ${7:0}, ${8:0}, ${9:0}, ${10:0}, ${11:1}, ${12:0}, ${13:2}, ${14:2}, ${15:0}, ${16:1})", 1124 | ], 1125 | ["perspective()", "perspective(${1:0})"], 1126 | ["rotate()", "rotate(${1:45deg})"], 1127 | ["rotate3d()", "rotate3d(${1:0}, ${2:0}, ${3:1}, ${4:45deg})"], 1128 | ["rotateX()", "rotateX(${1:45deg})"], 1129 | ["rotateY()", "rotateY(${1:45deg})"], 1130 | ["rotateZ()", "rotateZ(${1:45deg})"], 1131 | ["scale()", "scale(${1:1.0})"], 1132 | ["scale3d()", "scale3d(${1:1.0}, ${2:1.0}, ${3:1.0})"], 1133 | ["scaleX()", "scaleX(${1:1.0})"], 1134 | ["scaleY()", "scaleY(${1:1.0})"], 1135 | ["scaleZ()", "scaleZ(${1:1.0})"], 1136 | ["skew()", "skew(${1:10deg})"], 1137 | ["skewX()", "skewX(${1:10deg})"], 1138 | ["skewY()", "skewY(${1:10deg})"], 1139 | ["translate()", "translate(${1:10px})"], 1140 | ["translate3d()", "translate3d(${1:10px}, ${2:0px}, ${3:0px})"], 1141 | ["translateX()", "translateX(${1:10px})"], 1142 | ["translateY()", "translateY(${1:10px})"], 1143 | ["translateZ()", "translateZ(${1:10px})"], 1144 | ], 1145 | "transform-box": [ 1146 | "border-box", 1147 | "content-box", 1148 | "fill-box", 1149 | "stroke-box", 1150 | "view-box", 1151 | ], 1152 | "transform-origin": ["", ""], 1153 | "transform-style": ["preserve-3d", "flat"], 1154 | "transition": [ 1155 | "", 1156 | "", 1157 | "all", 1158 | "none", 1159 | ], 1160 | "transition-delay": [ 1161 | "", 1162 | ], 1163 | "transition-duration": [ 1164 | "", 1165 | ], 1166 | "transition-property": [ 1167 | "all", 1168 | "none", 1169 | ], 1170 | "transition-timing-function": ["", ""], 1171 | "translate": ["", "none"], 1172 | "unicode-bidi": [ 1173 | "bidi-override", 1174 | "embed", 1175 | "isolate", 1176 | "isolate-override", 1177 | "normal", 1178 | "plaintext", 1179 | ], 1180 | "unicode-range": [], 1181 | "user-select": ["all", "auto", "text", "none", "contain"], 1182 | "user-zoom": ["fixed", "zoom"], 1183 | "vertical-align": [ 1184 | "", 1185 | "baseline", 1186 | "sub", 1187 | "super", 1188 | "text-top", 1189 | "text-bottom", 1190 | "middle", 1191 | "top", 1192 | "bottom", 1193 | ], 1194 | "viewport-fit": ["auto", "contain", "cover"], 1195 | "visibility": ["visible", "hidden", "collapse"], 1196 | "white-space": [ 1197 | "break-spaces", 1198 | "normal", 1199 | "pre", 1200 | "nowrap", 1201 | "pre-wrap", 1202 | "pre-line", 1203 | "", 1204 | "", 1205 | "", 1206 | ], 1207 | "white-space-collapse": [""], 1208 | "white-space-trim": [""], 1209 | "widows": [ 1210 | "", 1211 | ], 1212 | "width": ["", "auto", "fit-content"], 1213 | "will-change": [ 1214 | "auto", 1215 | "contents", 1216 | "scroll-position", 1217 | ], 1218 | "word-break": ["normal", "break-all", "break-word", "keep-all"], 1219 | "word-spacing": [ 1220 | "", 1221 | "normal", 1222 | ], 1223 | "word-wrap": ["normal", "break-word"], 1224 | "writing-mode": [ 1225 | "horizontal-tb", 1226 | "vertical-rl", 1227 | "vertical-lr", 1228 | "sideways-rl", 1229 | "sideways-lr", 1230 | ], 1231 | "z-index": [ 1232 | "", 1233 | "auto", 1234 | ], 1235 | "zoom": ["", "auto", "normal", "reset"], 1236 | } 1237 | 1238 | props = {} 1239 | 1240 | for names, values in properties_dict.items(): 1241 | # Values that are allowed for all properties 1242 | allowed_values = ["inherit", "initial", "revert", "revert-layer", "unset", ["var()", "var($1)"]] 1243 | 1244 | # Determine which values are available for the current property name 1245 | for value in values: 1246 | if value[0] == "<" and value[-1] == ">": 1247 | key = value[1:-1] 1248 | if key in common_values: 1249 | allowed_values += common_values[key] 1250 | else: 1251 | allowed_values.append(value) 1252 | 1253 | for name in names.split(" | "): 1254 | props[name] = allowed_values 1255 | 1256 | return props 1257 | -------------------------------------------------------------------------------- /plugins/completions/provider.py: -------------------------------------------------------------------------------- 1 | import re 2 | import sublime 3 | import sublime_plugin 4 | 5 | from functools import cached_property 6 | 7 | from .function_args import get_func_args 8 | from .properties import get_properties 9 | 10 | __all__ = ['SassCompletions', 'ScssCompletions'] 11 | 12 | KIND_CSS_PROPERTY = (sublime.KIND_ID_KEYWORD, "p", "property") 13 | KIND_CSS_FUNCTION = (sublime.KIND_ID_FUNCTION, "f", "function") 14 | KIND_CSS_CONSTANT = (sublime.KIND_ID_VARIABLE, "c", "constant") 15 | 16 | 17 | def match_selector(view, pt, scope): 18 | # This will catch scenarios like: 19 | # - .foo {font-style: |} 20 | # - 21 | return any(view.match_selector(p, scope) for p in (pt, pt - 1)) 22 | 23 | 24 | def next_none_whitespace(view, pt): 25 | for pt in range(pt, view.size()): 26 | ch = view.substr(pt) 27 | if ch not in ' \t': 28 | return ch 29 | 30 | 31 | class BaseCompletionsProvider: 32 | 33 | @cached_property 34 | def func_args(self): 35 | return get_func_args() 36 | 37 | @cached_property 38 | def props(self): 39 | return get_properties() 40 | 41 | @cached_property 42 | def re_name(self): 43 | return re.compile(r"([a-zA-Z-]+)\s*:[^:;{}]*$") 44 | 45 | @cached_property 46 | def re_value(self): 47 | return re.compile(r"^(?:\s*(:)|([ \t]*))([^:]*)([;}])") 48 | 49 | def complete_property_name(self, view, prefix, pt, semicolon): 50 | text = view.substr(sublime.Region(pt, view.line(pt).end())) 51 | matches = self.re_value.search(text) 52 | if matches: 53 | colon, space, value, term = matches.groups() 54 | else: 55 | colon = "" 56 | space = "" 57 | value = "" 58 | term = "" 59 | 60 | # don't append anything if next character is a colon 61 | suffix = "" 62 | if not colon: 63 | # add space after colon if smart typing is enabled 64 | if not space and view.settings().get("auto_complete_trailing_spaces"): 65 | suffix = ": $0" 66 | else: 67 | suffix = ":$0" 68 | 69 | # terminate empty value if not within parentheses 70 | if semicolon and not value and not term and not match_selector(view, pt, "meta.group"): 71 | suffix += ";" 72 | 73 | return ( 74 | sublime.CompletionItem( 75 | trigger=prop, 76 | completion=prop + suffix, 77 | completion_format=sublime.COMPLETION_FORMAT_SNIPPET, 78 | kind=KIND_CSS_PROPERTY 79 | ) for prop in self.props 80 | ) 81 | 82 | def complete_property_value(self, view, prefix, pt, semicolon): 83 | completions = [ 84 | sublime.CompletionItem( 85 | trigger="!important", 86 | completion_format=sublime.COMPLETION_FORMAT_TEXT, 87 | kind=sublime.KIND_KEYWORD, 88 | details="override any other declaration" 89 | ) 90 | ] 91 | text = view.substr(sublime.Region(view.line(pt).begin(), pt - len(prefix))) 92 | matches = self.re_name.search(text) 93 | if matches: 94 | prop = matches.group(1) 95 | values = self.props.get(prop) 96 | if values: 97 | details = f"{prop} property-value" 98 | 99 | if semicolon and not match_selector(view, pt, "meta.group") and next_none_whitespace(view, pt) != ";": 100 | suffix = "$0;" 101 | else: 102 | suffix = "" 103 | 104 | for value in values: 105 | if isinstance(value, list): 106 | desc, snippet = value 107 | kind = KIND_CSS_FUNCTION 108 | else: 109 | desc = value 110 | snippet = value 111 | kind = KIND_CSS_CONSTANT 112 | 113 | completions.append(sublime.CompletionItem( 114 | trigger=desc, 115 | completion=snippet + suffix, 116 | completion_format=sublime.COMPLETION_FORMAT_SNIPPET, 117 | kind=kind, 118 | details=details 119 | )) 120 | 121 | return completions 122 | 123 | def complete_function_argument(self, view, prefix, pt): 124 | func_name = "" 125 | nest_level = 1 126 | # Look for the beginning of the current function call's arguments list, 127 | # while ignoring any nested function call or group. 128 | for i in range(pt - 1, pt - 32 * 1024, -1): 129 | ch = view.substr(i) 130 | # end of nested arguments list or group before caret 131 | if ch == ")" and not view.match_selector(i, "string, comment"): 132 | nest_level += 1 133 | continue 134 | # begin of maybe nested arguments list or group before caret 135 | if ch == "(" and not view.match_selector(i, "string, comment"): 136 | nest_level -= 1 137 | # Stop, if nesting level drops below start value as this indicates the 138 | # beginning of the arguments list the function name is of interest for. 139 | if nest_level <= 0: 140 | func_name = view.substr(view.expand_by_class( 141 | i - 1, sublime.CLASS_WORD_START | sublime.CLASS_WORD_END)) 142 | break 143 | 144 | if func_name == "var": 145 | return [ 146 | sublime.CompletionItem( 147 | trigger=symbol, 148 | completion_format=sublime.COMPLETION_FORMAT_TEXT, 149 | kind=sublime.KIND_VARIABLE, 150 | details="var() argument" 151 | ) 152 | for symbol in set( 153 | view.substr(symbol_region) 154 | for symbol_region in view.find_by_selector("entity.other.custom-property") 155 | ) 156 | if not prefix or symbol.startswith(prefix) 157 | ] 158 | 159 | args = self.func_args.get(func_name) 160 | if not args: 161 | return None 162 | 163 | completions = [] 164 | details = f"{func_name}() argument" 165 | for arg in args: 166 | if isinstance(arg, list): 167 | completions.append(sublime.CompletionItem( 168 | trigger=arg[0], 169 | completion=arg[1], 170 | completion_format=sublime.COMPLETION_FORMAT_SNIPPET, 171 | kind=KIND_CSS_FUNCTION, 172 | details=details 173 | )) 174 | else: 175 | completions.append(sublime.CompletionItem( 176 | trigger=arg, 177 | completion_format=sublime.COMPLETION_FORMAT_TEXT, 178 | kind=KIND_CSS_CONSTANT, 179 | details=details 180 | )) 181 | 182 | return completions 183 | 184 | 185 | class SassCompletions(BaseCompletionsProvider, sublime_plugin.EventListener): 186 | 187 | def on_query_completions(self, view, prefix, locations): 188 | settings = sublime.load_settings('Sass.sublime-settings') 189 | if settings.get('disable_default_completions'): 190 | return None 191 | 192 | selector = settings.get('default_completions_selector') 193 | if not selector: 194 | return None 195 | 196 | if isinstance(selector, list): 197 | selector = ''.join(selector) 198 | 199 | pt = locations[0] 200 | if not match_selector(view, pt, selector): 201 | return None 202 | 203 | if match_selector(view, pt, "meta.function-call.arguments"): 204 | items = self.complete_function_argument(view, prefix, pt) 205 | elif match_selector(view, pt - 1, "meta.property-value, punctuation.separator.key-value"): 206 | items = self.complete_property_value(view, prefix, pt, False) 207 | else: 208 | items = self.complete_property_name(view, prefix, pt, False) 209 | 210 | if items: 211 | return sublime.CompletionList(items) 212 | return None 213 | 214 | 215 | class ScssCompletions(BaseCompletionsProvider, sublime_plugin.EventListener): 216 | 217 | def on_query_completions(self, view, prefix, locations): 218 | settings = sublime.load_settings('SCSS.sublime-settings') 219 | if settings.get('disable_default_completions'): 220 | return None 221 | 222 | selector = settings.get('default_completions_selector') 223 | if not selector: 224 | return None 225 | 226 | if isinstance(selector, list): 227 | selector = ''.join(selector) 228 | 229 | pt = locations[0] 230 | if not match_selector(view, pt, selector): 231 | return None 232 | 233 | if match_selector(view, pt, "meta.function-call.arguments"): 234 | items = self.complete_function_argument(view, prefix, pt) 235 | elif view.match_selector(pt - 1, "meta.property-value, punctuation.separator.key-value"): 236 | items = self.complete_property_value(view, prefix, pt, True) 237 | else: 238 | items = self.complete_property_name(view, prefix, pt, True) 239 | 240 | if items: 241 | return sublime.CompletionList(items) 242 | return None 243 | --------------------------------------------------------------------------------