Function: js--treesit-font-lock-compatibility-definition-feature

js--treesit-font-lock-compatibility-definition-feature is a byte-compiled function defined in js.el.gz.

Signature

(js--treesit-font-lock-compatibility-definition-feature)

Documentation

Font lock helper, to handle different releases of tree-sitter-javascript.

Check if a node type is available, then return the right font lock rules for "definition" feature.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--treesit-font-lock-compatibility-definition-feature ()
  "Font lock helper, to handle different releases of tree-sitter-javascript.
Check if a node type is available, then return the right font lock rules
for \"definition\" feature."
  (condition-case nil
      (progn (treesit-query-capture 'javascript '((function_expression) @cap))
             ;; Starting from version 0.20.2 of the grammar.
             '((function_expression
                name: (identifier) @font-lock-function-name-face)
               (variable_declarator
                name: (identifier) @font-lock-function-name-face
                value: [(function_expression) (arrow_function)])))
    (error
     ;; An older version of the grammar.
     '((function
        name: (identifier) @font-lock-function-name-face)
       (variable_declarator
        name: (identifier) @font-lock-function-name-face
        value: [(function) (arrow_function)])))))