Skip to content

Commit 8a11d76

Browse files
committed
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 a9e3177 commit 8a11d76

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
@@ -71,6 +71,14 @@ contexts:
7171
- include: postcss-variable-definitions
7272
- include: postcss-variables
7373

74+
at-import-body:
75+
- meta_prepend: true
76+
- match: (?:(?!layer|supports|url){{ident}})(?=\()
77+
scope: meta.function-call.identifier.css variable.function.css
78+
push:
79+
- other-function-arguments-list-body
80+
- function-arguments-list-begin
81+
7482
at-other:
7583
- meta_prepend: true
7684
# known PostCSS at rules

tests/syntax_test.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)