Fix highlighting of CSS selectors with double hyphens
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Fix highlighting of selectors that contain double hyphens. They would be mistaken for a variable.
This commit is contained in:
parent
8160c7d914
commit
ee051688c1
2 changed files with 7 additions and 2 deletions
|
@ -852,8 +852,6 @@ cannot be completed sensibly: `custom-ident',
|
||||||
;; Since "An at-rule consists of everything up to and including the next
|
;; Since "An at-rule consists of everything up to and including the next
|
||||||
;; semicolon (;) or the next block, whichever comes first."
|
;; semicolon (;) or the next block, whichever comes first."
|
||||||
(,(concat "@" css-ident-re) (0 font-lock-builtin-face))
|
(,(concat "@" css-ident-re) (0 font-lock-builtin-face))
|
||||||
;; Variables.
|
|
||||||
(,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
|
|
||||||
;; Selectors.
|
;; Selectors.
|
||||||
;; Allow plain ":root" as a selector.
|
;; Allow plain ":root" as a selector.
|
||||||
("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
|
("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
|
||||||
|
@ -898,6 +896,8 @@ cannot be completed sensibly: `custom-ident',
|
||||||
'font-lock-multiline t)
|
'font-lock-multiline t)
|
||||||
;; No face.
|
;; No face.
|
||||||
nil)))
|
nil)))
|
||||||
|
;; Variables.
|
||||||
|
(,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
|
||||||
;; Properties. Again, we don't limit ourselves to css-property-ids.
|
;; Properties. Again, we don't limit ourselves to css-property-ids.
|
||||||
(,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
|
(,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
|
||||||
"\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
|
"\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
|
||||||
|
|
|
@ -77,3 +77,8 @@ div::before {
|
||||||
url("Sans-Regular.eot") format("eot"),
|
url("Sans-Regular.eot") format("eot"),
|
||||||
url("Sans-Regular.woff") format("woff");
|
url("Sans-Regular.woff") format("woff");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.foo-bar--baz {
|
||||||
|
--foo-variable: 5px;
|
||||||
|
margin: var(--foo-variable);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue