Skip to content

Commit

Permalink
@container rule being flagged as "unknownAtRules" when nested in SCSS
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Mar 22, 2024
1 parent c17c287 commit 4f257bd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/parser/lessParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export class LESSParser extends cssParser.Parser {
|| this._parseSupports(true) // @supports
|| this._parseLayer() // @layer
|| this._parsePropertyAtRule() // @property
|| this._parseContainer() // @container
|| this._parseDetachedRuleSetMixin() // less detached ruleset mixin
|| this._parseVariableDeclaration() // Variable declarations
|| this._parseRuleSetDeclarationAtStatement();
Expand Down
3 changes: 2 additions & 1 deletion src/parser/scssParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export class SCSSParser extends cssParser.Parser {
|| this._parseSupports(true) // @supports
|| this._parseLayer() // @layer
|| this._parsePropertyAtRule() // @property
|| this._parseContainer() // @container
|| this._parseRuleSetDeclarationAtStatement();
}
return this._parseVariableDeclaration() // variable declaration
Expand Down Expand Up @@ -939,7 +940,7 @@ export class SCSSParser extends cssParser.Parser {
this.accept(TokenType.Comma);
}

// More than just identifier
// More than just identifier
return node.getChildren().length > 1 ? node : null;
}

Expand Down
5 changes: 5 additions & 0 deletions src/test/less/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,9 @@ suite('LESS - Parser', () => {
const parser = new LESSParser();
assertNode('@plugin "my-plugin";', parser, parser._parseStylesheet.bind(parser));
});

test('@container', function () {
const parser = new LESSParser();
assertNode(`.item-icon { @container (max-height: 100px) { .item-icon { display: none; } } }`, parser, parser._parseStylesheet.bind(parser));
});
});
1 change: 1 addition & 0 deletions src/test/scss/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ suite('SCSS - Parser', () => {
test('@container', function () {
const parser = new SCSSParser();
assertNode(`@container (min-width: #{$minWidth}) { .scss-interpolation { line-height: 10cqh; } }`, parser, parser._parseStylesheet.bind(parser));
assertNode(`.item-icon { @container (max-height: 100px) { .item-icon { display: none; } } }`, parser, parser._parseStylesheet.bind(parser));
});

test('@use', function () {
Expand Down

0 comments on commit 4f257bd

Please sign in to comment.