Skip to content

Instantly share code, notes, and snippets.

@gruggiero
Created May 3, 2016 14:31
Show Gist options
  • Save gruggiero/a07d777f8be7d838423d023474a6126e to your computer and use it in GitHub Desktop.
Save gruggiero/a07d777f8be7d838423d023474a6126e to your computer and use it in GitHub Desktop.
(defun ensime-refactor-add-hole (type)
"Add a hole definition and insert it at point."
(interactive "sHole type (default String): ")
(let ((hole-type (if (string= type "")
"String"
type))
(hole-name ""))
(save-excursion
(scala-syntax:beginning-of-definition)
(save-excursion
(re-search-forward scala-syntax:all-definition-re)
(setq hole-name (concat "hole_" (thing-at-point 'symbol))))
(insert "def " hole-name ": " hole-type " = ???")
(ensime-indent-line)
(insert "\n\n")
(ensime-indent-line))
(insert hole-name)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment