Add more font-lock settings to css-ts-mode
* lisp/textmodes/css-mode.el (css--treesit-settings): Add new font-lock features 'query', 'keyword', 'operator' and 'bracket'. (css-ts-mode): Use new features.
This commit is contained in:
parent
f794263da2
commit
bbf1b93d43
1 changed files with 31 additions and 3 deletions
|
@ -1353,10 +1353,27 @@ for determining whether point is within a selector."
|
|||
:language 'css
|
||||
'((string_value) @font-lock-string-face)
|
||||
|
||||
:feature 'keyword
|
||||
:language 'css
|
||||
'(["@media"
|
||||
"@import"
|
||||
"@charset"
|
||||
"@namespace"
|
||||
"@keyframes"] @font-lock-builtin-face
|
||||
["and"
|
||||
"or"
|
||||
"not"
|
||||
"only"
|
||||
"selector"] @font-lock-keyword-face)
|
||||
|
||||
:feature 'variable
|
||||
:language 'css
|
||||
'((plain_value) @font-lock-variable-name-face)
|
||||
|
||||
:language 'css
|
||||
:feature 'operator
|
||||
`(["=" "~=" "^=" "|=" "*=" "$="] @font-lock-operator-face)
|
||||
|
||||
:feature 'selector
|
||||
:language 'css
|
||||
'((class_selector) @css-selector
|
||||
|
@ -1377,7 +1394,18 @@ for determining whether point is within a selector."
|
|||
:language 'css
|
||||
'((integer_value) @font-lock-number-face
|
||||
(float_value) @font-lock-number-face
|
||||
(unit) @font-lock-constant-face)
|
||||
(unit) @font-lock-constant-face
|
||||
(important) @font-lock-builtin-face)
|
||||
|
||||
:feature 'query
|
||||
:language 'css
|
||||
'((keyword_query) @font-lock-property-face
|
||||
(feature_name) @font-lock-property-face)
|
||||
|
||||
|
||||
:feature 'bracket
|
||||
:language 'css
|
||||
'((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
|
||||
|
||||
:feature 'error
|
||||
:language 'css
|
||||
|
@ -1808,9 +1836,9 @@ can also be used to fill comments.
|
|||
(setq-local treesit-defun-type-regexp "rule_set")
|
||||
(setq-local treesit-font-lock-settings css--treesit-settings)
|
||||
(setq-local treesit-font-lock-feature-list
|
||||
'((selector comment)
|
||||
'((selector comment query keyword)
|
||||
(property constant string)
|
||||
(error variable function)))
|
||||
(error variable function operator bracket)))
|
||||
;; Tree-sitter-css, for whatever reason, cannot reliably return
|
||||
;; the captured nodes in a given range (it instead returns the
|
||||
;; nodes preceding range). Before this is fixed in
|
||||
|
|
Loading…
Add table
Reference in a new issue