emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6dd1565fcf2: Various fixes to lua-ts-mode font-locking


From: Stefan Kangas
Subject: master 6dd1565fcf2: Various fixes to lua-ts-mode font-locking
Date: Sat, 30 Sep 2023 19:18:30 -0400 (EDT)

branch: master
commit 6dd1565fcf2887d4758e8a779f0c9d6320e85385
Author: john muhl <jm@pub.pink>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Various fixes to lua-ts-mode font-locking
    
    * lisp/progmodes/lua-ts-mode.el (lua-ts--font-lock-settings):
    Identify functions and assignments in more places.  Use constant
    face for goto/labels.  (Bug#66162)
---
 lisp/progmodes/lua-ts-mode.el | 56 ++++++++++++++++++++++++++++++-------------
 1 file changed, 40 insertions(+), 16 deletions(-)

diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 071953d3d2f..030a3585158 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -121,7 +121,9 @@
    :feature 'constant
    '((variable_list
       attribute: (attribute (["<" ">"] (identifier))))
-     @font-lock-constant-face)
+     @font-lock-constant-face
+     (goto_statement (identifier) @font-lock-constant-face)
+     (label_statement) @font-lock-constant-face)
 
    :language 'lua
    :feature 'operator
@@ -131,12 +133,6 @@
      @font-lock-operator-face
      (vararg_expression) @font-lock-operator-face)
 
-   :language 'lua
-   :feature 'property
-   '((field name: (identifier) @font-lock-property-name-face)
-     (dot_index_expression
-      field: (identifier) @font-lock-property-use-face))
-
    :language 'lua
    :feature 'builtin
    `(((identifier) @font-lock-builtin-face
@@ -150,8 +146,7 @@
       name: (method_index_expression
              method: (identifier) @font-lock-function-call-face))
      (function_call
-      name: (dot_index_expression
-             table: (identifier) @font-lock-function-call-face)))
+      name: (dot_index_expression (identifier) @font-lock-function-call-face)))
 
    :language 'lua
    :feature 'punctuation
@@ -164,12 +159,7 @@
       @font-lock-variable-use-face)
      (function_call
       name: (method_index_expression
-             table: (identifier) @font-lock-variable-use-face))
-     (goto_statement (identifier) @font-lock-variable-use-face))
-
-   :language 'lua
-   :feature 'assignment
-   '((variable_list (identifier) @font-lock-variable-name-face))
+             table: (identifier) @font-lock-variable-use-face)))
 
    :language 'lua
    :feature 'number
@@ -199,9 +189,43 @@
    :feature 'definition
    '((function_declaration
       name: (identifier) @font-lock-function-name-face)
+     (assignment_statement
+      (variable_list name: [(identifier)]) @font-lock-function-name-face
+      (expression_list value: (function_definition)))
+     (table_constructor
+      (field
+        name: (identifier) @font-lock-function-name-face
+        value: (function_definition)))
+     (function_declaration
+      name: (dot_index_expression (identifier) @font-lock-function-name-face))
+     (function_declaration
+      name: (method_index_expression (identifier) 
@font-lock-function-name-face))
+     (function_declaration
+      (method_index_expression
+       (dot_index_expression
+        table: (identifier) @font-lock-function-name-face
+        field: (identifier) @font-lock-property-name-face
+        )))
      (parameters
       name: (identifier) @font-lock-variable-name-face)
-     (label_statement) @font-lock-variable-name-face)
+     (for_numeric_clause name: (identifier) @font-lock-variable-name-face))
+
+   :language 'lua
+   :feature 'property
+   '((field name: (identifier) @font-lock-property-name-face)
+     (dot_index_expression
+      field: (identifier) @font-lock-property-use-face))
+
+   :language 'lua
+   :feature 'assignment
+   '((variable_list
+      [(identifier)
+       (bracket_index_expression)]
+      @font-lock-variable-name-face)
+     (variable_list
+      (dot_index_expression
+       table: (identifier))
+      @font-lock-variable-name-face))
 
    :language 'lua
    :feature 'error



reply via email to

[Prev in Thread] Current Thread [Next in Thread]