Function: tsx-ts-mode--font-lock-compatibility-bb1f97b
tsx-ts-mode--font-lock-compatibility-bb1f97b is a byte-compiled
function defined in typescript-ts-mode.el.gz.
Signature
(tsx-ts-mode--font-lock-compatibility-bb1f97b LANGUAGE)
Documentation
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.
Argument LANGUAGE is either typescript or tsx.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/typescript-ts-mode.el.gz
(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.
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 language '((jsx_opening_element (member_expression) @capture)))
'((jsx_opening_element
[(member_expression (identifier)) (identifier)]
@typescript-ts-jsx-tag-face)
(jsx_closing_element
[(member_expression (identifier)) (identifier)]
@typescript-ts-jsx-tag-face)
(jsx_self_closing_element
[(member_expression (identifier)) (identifier)]
@typescript-ts-jsx-tag-face)))
(treesit-query-error
'((jsx_opening_element
[(nested_identifier (identifier)) (identifier)]
@typescript-ts-jsx-tag-face)
(jsx_closing_element
[(nested_identifier (identifier)) (identifier)]
@typescript-ts-jsx-tag-face)
(jsx_self_closing_element
[(nested_identifier (identifier)) (identifier)]
@typescript-ts-jsx-tag-face)))))