Function: go-mod-ts-mode--directive-matcher

go-mod-ts-mode--directive-matcher is a byte-compiled function defined in go-ts-mode.el.gz.

Signature

(go-mod-ts-mode--directive-matcher)

Documentation

Return a function for determining if point is inside a Go module directive.

When entering an empty directive or adding a new entry to one, no node will be present meaning none of the indentation rules will match, because there is no parent to match against. This function determines what the parent of the node would be if it were a node.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/go-ts-mode.el.gz
(defun go-mod-ts-mode--directive-matcher ()
  "Return a function for determining if point is inside a Go module directive.
When entering an empty directive or adding a new entry to one, no node
will be present meaning none of the indentation rules will match,
because there is no parent to match against.  This function determines
what the parent of the node would be if it were a node."
  (lambda (node _ _ &rest _)
    (unless (treesit-node-type node)
      (save-excursion
        (backward-up-list)
        (back-to-indentation)
        (member (treesit-node-type (treesit-node-at (point)))
                '("exclude"
                  "module"
                  "replace"
                  "require"
                  "retract"))))))