Function: tsx-ts-mode--indent-compatibility-b893426

tsx-ts-mode--indent-compatibility-b893426 is a byte-compiled function defined in typescript-ts-mode.el.gz.

Signature

(tsx-ts-mode--indent-compatibility-b893426)

Documentation

Indent rules helper, to handle different releases of tree-sitter-tsx.

Check if a node type is available, then return the right indent rules.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/typescript-ts-mode.el.gz
(defun tsx-ts-mode--indent-compatibility-b893426 ()
  "Indent rules helper, to handle different releases of tree-sitter-tsx.
Check if a node type is available, then return the right indent rules."
  ;; handle https://github.com/tree-sitter/tree-sitter-typescript/commit/b893426b82492e59388a326b824a346d829487e8
  (condition-case nil
      (progn (treesit-query-capture 'tsx '((jsx_fragment) @capture))
             `(((match "<" "jsx_fragment") parent 0)
               ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset)))
    (treesit-query-error
     `(((match "<" "jsx_text") parent 0)
       ((parent-is "jsx_text") parent-bol typescript-ts-mode-indent-offset)))))