Open shouya opened 3 years ago
My current workaround is to patch projectile--test-name-for-impl-name
function like this:
;; Elixir: jump to *_test.exs instead of *_test.ex
(defun shou/fix-exs-test-file-name (name)
(cond
((string-suffix-p "_test.ex" name) (concat name "s"))
(t name)))
(advice-add #'projectile--test-name-for-impl-name
:filter-return
#'shou/fix-exs-test-file-name)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
Suppose I have a mix project consisting of a file
lib/foo.ex
, then I run(projectile-toggle-between-implementation-and-test)
, projectile will land on a new file attest/foo_test.ex
.The generated file name of this shape should be expected for most languages. But for Elixir, by conventions, the test files should be elixir script files (
.exs
) rather than elixir source files (.ex
).From Projectile doc there is customizable field
:test-suffix
that looks promising. However, it only affects the part of the test file name before the extname (i.e. the_test
part as oppose to_test.exs
).I checked the source code and confirmed that the extname of the test file is hard-coded to be the same as the impl file.
Is there any possibility to support this feature of having different extname for test and impl files? Thanks.