diff options
author | dannyfreeman <danny@dfreeman.email> | 2023-08-11 16:43:58 -0400 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-08-17 11:05:00 +0300 |
commit | 8f683b51d8bc9e8c66608fb6056e0f8765f274f8 (patch) | |
tree | 2d8e7c51c02ae35b97a2ab3b07f8a969036b19f8 /lisp/progmodes/js.el | |
parent | d9af79ae39d3216273faa923d91f586b0a16cc04 (diff) | |
download | emacs-8f683b51d8bc9e8c66608fb6056e0f8765f274f8.tar.gz emacs-8f683b51d8bc9e8c66608fb6056e0f8765f274f8.tar.bz2 emacs-8f683b51d8bc9e8c66608fb6056e0f8765f274f8.zip |
Fix jsx font-lock in older tree-sitter-js grammars
* lisp/progmodes/js.el (js--treesit-font-lock-settings): Use
queries that are backwards compatible with
tree-sitter-javascript bb1f97b.
* list/progmodes/js.el
(-jsx--treesit-font-lock-compatibility-bb1f97b): Delete unused
function. (Bug#65234)
Diffstat (limited to 'lisp/progmodes/js.el')
-rw-r--r-- | lisp/progmodes/js.el | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index c583b6f6191..9d2990e7bc9 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3501,35 +3501,6 @@ Check if a node type is available, then return the right indent rules." "&&" "||" "!") "JavaScript operators for tree-sitter font-locking.") -(defun js-jsx--treesit-font-lock-compatibility-bb1f97b () - "Font lock rules helper, to handle different releases of tree-sitter-javascript. -Check if a node type is available, then return the right font lock rules." - ;; handle commit bb1f97b - (condition-case nil - (progn (treesit-query-capture 'javascript '((member_expression) @capture)) - '((jsx_opening_element - [(member_expression (identifier)) (identifier)] - @font-lock-function-call-face) - - (jsx_closing_element - [(member_expression (identifier)) (identifier)] - @font-lock-function-call-face) - - (jsx_self_closing_element - [(member_expression (identifier)) (identifier)] - @font-lock-function-call-face))) - (error '((jsx_opening_element - [(nested_identifier (identifier)) (identifier)] - @font-lock-function-call-face) - - (jsx_closing_element - [(nested_identifier (identifier)) (identifier)] - @font-lock-function-call-face) - - (jsx_self_closing_element - [(nested_identifier (identifier)) (identifier)] - @font-lock-function-call-face))))) - (defvar js--treesit-font-lock-settings (treesit-font-lock-rules @@ -3639,8 +3610,10 @@ Check if a node type is available, then return the right font lock rules." :language 'javascript :feature 'jsx - (append (js-jsx--treesit-font-lock-compatibility-bb1f97b) - '((jsx_attribute (property_identifier) @font-lock-constant-face))) + '((jsx_opening_element name: (_) @font-lock-function-call-face) + (jsx_closing_element name: (_) @font-lock-function-call-face) + (jsx_self_closing_element name: (_) @font-lock-function-call-face) + (jsx_attribute (property_identifier) @font-lock-constant-face)) :language 'javascript :feature 'number |