Function: tsx-ts-mode--font-lock-compatibility-function-expression

tsx-ts-mode--font-lock-compatibility-function-expression is a byte-compiled function defined in typescript-ts-mode.el.gz.

Signature

(tsx-ts-mode--font-lock-compatibility-function-expression LANGUAGE)

Documentation

Handle tree-sitter grammar breaking change for function expression.

LANGUAGE can be typescript or tsx. Starting from version 0.20.4 of the typescript/tsx grammar, function becomes function_expression.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/typescript-ts-mode.el.gz
(defun tsx-ts-mode--font-lock-compatibility-function-expression (language)
  "Handle tree-sitter grammar breaking change for `function' expression.

LANGUAGE can be `typescript' or `tsx'.  Starting from version 0.20.4 of the
typescript/tsx grammar, `function' becomes `function_expression'."
  (typescript-ts-mode--check-dialect language)
  (condition-case nil
      (progn (treesit-query-capture language '((function_expression) @cap))
             ;; New version of the grammar
             'function_expression)
    (treesit-query-error
    ;; Old version of the grammar
    'function)))