mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-22 10:26:20 +00:00
Support indentation of detached Less CSS rulesets
* lisp/textmodes/css-mode.el (css-smie-rules): Provide better support for indentation of detached rulesets passed to Less mixins. * test/manual/indent/less-css-mode.less: New file.
This commit is contained in:
parent
85a9f42b6c
commit
141cc78aa4
@ -1205,9 +1205,12 @@ for determining whether point is within a selector."
|
||||
(`(:before . "{")
|
||||
(when (or (smie-rule-hanging-p) (smie-rule-bolp))
|
||||
(smie-backward-sexp ";")
|
||||
(smie-indent-virtual)))
|
||||
(`(:before . ,(or "{" "("))
|
||||
(if (smie-rule-hanging-p) (smie-rule-parent 0)))
|
||||
(unless (eq (char-after) ?\{)
|
||||
(smie-indent-virtual))))
|
||||
(`(:before . "(")
|
||||
(cond
|
||||
((smie-rule-hanging-p) (smie-rule-parent 0))
|
||||
((not (smie-rule-bolp)) 0)))
|
||||
(`(:after . ":-property")
|
||||
(when (smie-rule-hanging-p)
|
||||
css-indent-offset))))
|
||||
|
29
test/manual/indent/less-css-mode.less
Normal file
29
test/manual/indent/less-css-mode.less
Normal file
@ -0,0 +1,29 @@
|
||||
.desktop-and-old-ie(@rules) {
|
||||
@media screen and (min-width: 1200) { @rules(); }
|
||||
html.lt-ie9 & { @rules(); }
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: blue;
|
||||
|
||||
.desktop-and-old-ie({
|
||||
background-color: red;
|
||||
});
|
||||
}
|
||||
|
||||
.e(@name, @rules) {
|
||||
&__@{name} { @rules(); }
|
||||
}
|
||||
|
||||
.m(@name, @rules) {
|
||||
&--@{name} { @rules(); }
|
||||
}
|
||||
|
||||
.btn {
|
||||
.e(span, { // .btn__span
|
||||
display: inline-block;
|
||||
});
|
||||
.m(primary, { // .btn--primary
|
||||
background: blue;
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user