Skip to content

Commit f67cfa8

Browse files
authored
Add support for custom @import modifier functions (#2)
This commit adds patterns to scope function calls of unknown names within import at-rules, as PostCSS can add additional language features via plugins' custom parsers.
1 parent f450720 commit f67cfa8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

PostCSS.sublime-syntax

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ contexts:
5757
- include: postcss-variable-definitions
5858
- include: postcss-variables
5959

60+
at-import-body:
61+
- meta_prepend: true
62+
- match: (?:(?!layer|supports|url){{ident}})(?=\()
63+
scope: meta.function-call.identifier.css variable.function.css
64+
push:
65+
- other-function-arguments-list-body
66+
- function-arguments-list-begin
67+
6068
at-other:
6169
- meta_prepend: true
6270
- include: postcss-at-apply

tests/syntax_test_scope.postcss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@
2424
// ^^^ variable.other.postcss
2525
// ^ punctuation.section.interpolation.end.postcss
2626

27+
/*
28+
* import at-rules
29+
*/
30+
31+
@import "url" prefix(tw);
32+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.css.postcss
33+
// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.import.css
34+
// ^^^^^^^ keyword.control.directive.css
35+
// ^ punctuation.definition.keyword.css
36+
// ^^^^^ meta.string.css string.quoted.double.css
37+
// ^ punctuation.definition.string.begin.css
38+
// ^ punctuation.definition.string.end.css
39+
// ^^^^^^ variable.function.css
40+
// ^^^^ meta.function-call.arguments.css meta.group.css
41+
// ^ punctuation.section.group.begin.css
42+
// ^^ support.constant.property-value.css
43+
// ^ punctuation.section.group.end.css
44+
// ^ punctuation.terminator.rule.css
45+
2746
/*
2847
* unknown at-rules
2948
*/

0 commit comments

Comments
 (0)