Function: haskell-ts--stand-alone-parent

haskell-ts--stand-alone-parent is a natively compiled function defined in haskell-ts-mode.el.

Signature

(haskell-ts--stand-alone-parent _ PARENT _ &optional LAST_NON_PAREN FIRST)

Source Code

;; Defined in /nix/store/84k99g1lc4gz6zw2djcsyzr9zviz842h-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-ts-mode-1.3.5/haskell-ts-mode.el
(defun haskell-ts--stand-alone-parent (_ parent _ &optional last_non_paren first)
  (save-excursion
    (goto-char (treesit-node-start parent))
    (let* ((type (treesit-node-type parent))
           (res (if (or (and first
                             (member
                              type
                              '("when" "do" "let_in" "local_binds" "function")))
                        (looking-back "^[ \t]*" (line-beginning-position)))
                    (treesit-node-start (if (and (string= "parens" type) last_non_paren)
                                            last_non_paren
                                          parent))
                  (haskell-ts--stand-alone-parent 1
                                                  (treesit-node-parent parent)
                                                  nil
                                                  (if (string= "parens" type)
                                                      last_non_paren
                                                    parent)
                                                  t))))
      ;; This is an astronomically huge hack.  The kind where if you
      ;; took it you wouldn't be able to walk for several days after,
      ;; no homo
      (let ((adjustments '(("conditional" . 2)
                           ("local_binds" . 1))))
        (if-let* ((offset (assoc-string type adjustments)))
            (+ (cdr offset) res)
          res)
        ))))