# -*- mode: snippet -*-
# name: abstract method
# key: abstract
# expand-env: ((yas-indent-line 'fixed))
# condition: (not (magik-yasnippet--line-after-point-contains-method-p))
# group: methods
# type: command
# --
(let* ((snippet-content '())
       (pragma-snippet (car (magik-yasnippet-pragma-snippet nil)))
       (dollar-count (cadr (magik-yasnippet-pragma-snippet nil)))
       (doc-string (magik-yasnippet-documentation))
       (method-line (concat "_abstract _method "
			    (magik-yasnippet-prev-class-name-with-dot)
                            "${"
                            (number-to-string (+ dollar-count 1))
                            ":name}")))

  (setq snippet-content
	(delq nil
              (list pragma-snippet
		    method-line
		    (unless (string-empty-p doc-string) doc-string)
		    "\t$0"
		    "_endmethod"
		    "$"
                    "")))

  (yas-expand-snippet (string-join snippet-content "\n")))