Add Mixin proposals#17
Add Mixin proposals#17mrmlnc wants to merge 2 commits intomicrosoft:masterfrom mrmlnc:mixin-proposals
Conversation
|
Hmmm, I don't see ability to handling nested selectors for Mixins in Less. .mixin(@a: 1, @b) { content: @a + @b; }; .| // SimpleSelector
.mixin(@a: 1, @b) { content: @a + @b; }; .test { .|} // Declarations
.mixin(@a: 1, @b) { content: @a + @b; }; .test { .| // NothingIn case with .test {
color: #fff;
.|
content: 123;
} |
|
@mrmlnc Thank a lot! |
|
Yeap, that's good 👍. But what to do with Mixins in Less? We have three contexts and one of them does not exist in the AST. In my plugins I use the current string for comparison |
|
For LESS we need to override 'parseRuleset' to detect rulesets with selectors that are valid mixin declarations and annotate the selector identifier. |
|
Now AST contains all Mixins in the Less file. Sorry, I was not entirely correct. The problem is that Mixin can be called in different contexts:
.mixin() {}
.m|
.mixin() {}
.test {
.m|
}
.mixin() {}
.test {
.m|
// without }Also, the problem is that we cannot determine: MixinReference before us or Selector. Because the selector becomes MixinReference only when I add |
Source: #16
This PR adds:
@includekeyword