Skip to content

Commit 3ff2fde

Browse files
committed
Implement ability to switch from .purs to .js FFI file
Emacs provides a `(ff-find-other-file nil t)` function to switch between header and implementations. The closest PureScript has to such idea is the FFI, where given `Foo.purs` there has to be similarly named `Foo.js`, and unsurprisingly I keep pressing a keybind trying to switch between them. So add the mapping from `.purs` to `.js`. Worth noting that this doesn't provide the reverse mapping `.js → .purs` because js is a different major mode and we can't be making assumptions on whether it's related to PureScript… Usually. We probably could reassign in case the js file was open by the `ff-find-other-file`, but let's keep it simple for now.
1 parent d187b3d commit 3ff2fde

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

purescript-mode.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ see documentation for that variable for more details."
340340
(set (make-local-variable 'dabbrev-case-distinction) nil)
341341
(set (make-local-variable 'dabbrev-case-replace) nil)
342342
(set (make-local-variable 'dabbrev-abbrev-char-regexp) "\\sw\\|[.]")
343-
(setq prettify-symbols-alist purescript-font-lock-prettify-symbols-alist)
343+
(setq prettify-symbols-alist purescript-font-lock-prettify-symbols-alist
344+
;; make (ff-find-other-file) find .js FFI file, given .purs
345+
ff-other-file-alist '((".purs$" (".js"))))
344346
(when (bound-and-true-p purescript-font-lock-symbols)
345347
(warn "`purescript-font-lock-symbols' is obsolete: please enable `prettify-symbols-mode' locally or globally instead."))
346348
)

0 commit comments

Comments
 (0)