emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 4e977136d31: Make compat check also check typescript


From: Theodor Thornhill
Subject: emacs-29 4e977136d31: Make compat check also check typescript
Date: Mon, 24 Jul 2023 10:22:48 -0400 (EDT)

branch: emacs-29
commit 4e977136d3148c3baa0e03568c7a2c7dc28eea65
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Theodor Thornhill <theo@thornhill.no>

    Make compat check also check typescript
    
    * lisp/progmodes/typescript-ts-mode.el
    (tsx-ts-mode--font-lock-compatibility-bb1f97b):
    Add argument so that we run the 'treesit-query-capture' when the
    language is 'typescript', not only 'tsx'.
    
    * lisp/progmodes/typescript-ts-mode.el
    (typescript-ts-mode--font-lock-settings): Use supplied argument.
---
 lisp/progmodes/typescript-ts-mode.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
index ae0a80aea86..bacf9fbd08e 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -154,15 +154,16 @@ Argument LANGUAGE is either `typescript' or `tsx'."
     "&&" "||" "!" "?.")
   "TypeScript operators for tree-sitter font-locking.")
 
-(defun tsx-ts-mode--font-lock-compatibility-bb1f97b ()
+(defun tsx-ts-mode--font-lock-compatibility-bb1f97b (language)
   "Font lock rules helper, to handle different releases of tree-sitter-tsx.
-Check if a node type is available, then return the right font lock rules."
+Check if a node type is available, then return the right font lock rules.
+Argument LANGUAGE is either `typescript' or `tsx'."
   ;; handle commit bb1f97b
   ;; Warning: treesitter-query-capture says both node types are valid,
   ;; but then raises an error if the wrong node type is used. So it is
   ;; important to check with the new node type (member_expression)
   (condition-case nil
-      (progn (treesit-query-capture 'tsx '((member_expression) @capture))
+      (progn (treesit-query-capture language '((member_expression) @capture))
             '((jsx_opening_element
                [(member_expression (identifier)) (identifier)]
                @typescript-ts-jsx-tag-face)
@@ -337,7 +338,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
 
    :language language
    :feature 'jsx
-   (append (tsx-ts-mode--font-lock-compatibility-bb1f97b)
+   (append (tsx-ts-mode--font-lock-compatibility-bb1f97b language)
           `((jsx_attribute (property_identifier) 
@typescript-ts-jsx-attribute-face)))
 
    :language language



reply via email to

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