Support Haskell test toggling
Toggle between Haskell modules and test files.
This commit is contained in:
parent
30cdf1e941
commit
27b1a74d07
1 changed files with 25 additions and 0 deletions
|
@ -28,5 +28,30 @@
|
||||||
(dolist (item m-symbols) (add-to-list 'haskell-font-lock-symbols-alist item)))
|
(dolist (item m-symbols) (add-to-list 'haskell-font-lock-symbols-alist item)))
|
||||||
(setq haskell-font-lock-symbols t))
|
(setq haskell-font-lock-symbols t))
|
||||||
|
|
||||||
|
(defun empire/haskell/module->test ()
|
||||||
|
"Jump from a module to a test."
|
||||||
|
(let ((filename (->> buffer-file-name
|
||||||
|
(s-replace "/src/" "/test/")
|
||||||
|
(s-replace ".hs" "Test.hs")
|
||||||
|
find-file)))
|
||||||
|
(make-directory (f-dirname filename) t)
|
||||||
|
(find-file filename)))
|
||||||
|
|
||||||
|
(defun empire/haskell/test->module ()
|
||||||
|
"Jump from a test to a module."
|
||||||
|
(let ((filename (->> buffer-file-name
|
||||||
|
(s-replace "/test/" "/src/")
|
||||||
|
(s-replace "Test.hs" ".hs")
|
||||||
|
)))
|
||||||
|
(make-directory (f-dirname filename) t)
|
||||||
|
(find-file filename)))
|
||||||
|
|
||||||
|
(defun empire/haskell/test<->module ()
|
||||||
|
"Toggle between test and module in Haskell."
|
||||||
|
(interactive)
|
||||||
|
(if (s-contains? "/src/" buffer-file-name)
|
||||||
|
(empire/haskell/module->test)
|
||||||
|
(empire/haskell/test->module)))
|
||||||
|
|
||||||
(provide 'wpc-haskell)
|
(provide 'wpc-haskell)
|
||||||
;;; haskell.el ends here
|
;;; haskell.el ends here
|
||||||
|
|
Loading…
Reference in a new issue