]> git.eshelyaron.com Git - emacs.git/commitdiff
Move around java-ts-mode font-lock rules (bug#75154)
authorYuan Fu <casouri@gmail.com>
Mon, 17 Mar 2025 05:30:42 +0000 (22:30 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 17 Mar 2025 11:06:08 +0000 (12:06 +0100)
* lisp/progmodes/java-ts-mode.el:
(java-ts-mode--font-lock-settings): Move constant feature down
so it overrides expression and definition.

(cherry picked from commit 3d2d95e28431a16897a65543d8b26c791b389ef6)

lisp/progmodes/java-ts-mode.el

index 28f8ef3c8f2bb4b938eaf387dac491184e99762b..80a6130ab2ac1ff5c903ded8dced6e48e7341b3c 100644 (file)
@@ -244,11 +244,6 @@ For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'."
      (block_comment) @font-lock-comment-face)
    :language 'java
    :override t
-   :feature 'constant
-   `((identifier) @java-ts-mode--fontify-constant
-     [(true) (false)] @font-lock-constant-face)
-   :language 'java
-   :override t
    :feature 'keyword
    `([,@java-ts-mode--keywords
       (this)
@@ -354,7 +349,13 @@ For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'."
      (argument_list (identifier) @font-lock-variable-name-face)
 
      (expression_statement (identifier) @font-lock-variable-use-face))
-
+   ;; Make sure the constant feature is after expression and definition,
+   ;; because those two applies variable-name-face on some constants.
+   :language 'java
+   :override t
+   :feature 'constant
+   `((identifier) @java-ts-mode--fontify-constant
+     [(true) (false)] @font-lock-constant-face)
    :language 'java
    :feature 'bracket
    '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)