From: Theodor Thornhill Date: Mon, 28 Nov 2022 08:35:15 +0000 (+0100) Subject: Add more font-lock settings to css-ts-mode X-Git-Tag: emacs-29.0.90~1432^2~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bbf1b93d434d60c0f85eba32f69a96b8899563cc;p=emacs.git 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. --- diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 734252ee66f..b82886e3974 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -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