Recognize some more SCSS selectors

* lisp/textmodes/css-mode.el (css--selector-regexp): Recognize some
more SCSS selectors.

* test/lisp/textmodes/css-mode-resources/scss-selectors.txt: Add tests
for them.
This commit is contained in:
Simen Heggestøyl 2022-05-15 16:22:14 +02:00
parent f171a36c0a
commit 4aa8115855
2 changed files with 6 additions and 2 deletions

View file

@ -936,8 +936,8 @@ cannot be completed sensibly: `custom-ident',
;; Same as for non-sassy except we do want to allow { and }
;; chars in selectors in the case of #{$foo}
;; variable interpolation!
(concat "\\(?:[-_%*#.>[:alnum:]]*" scss--hash-re
"\\|[-_%*#.>[:alnum:]]+\\)"))
(concat "\\(?:[-_%*#.>&+~[:alnum:]]*" scss--hash-re
"\\|[-_%*#.>&+~[:alnum:]]+\\)"))
;; Even though pseudo-elements should be prefixed by ::, a
;; single colon is accepted for backward compatibility.
"\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids

View file

@ -4,3 +4,7 @@ p.#{$name}::after var
f.#{$bar}::after p::after
p.#{$name} f.#{$bar} k.var #{$bar} #{$bar}
p.#{$name}
&:hover
> li
+ li
~ li