Resurrect Default src-dir and test-dir for project-types #1769
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this is a proposed fix for #1765, it (re) adds a default value for the
src-dir
andtest-dir
properties for project types (="src/"
and"test/"
). The main effect is forprojectile-toggle-between-implementation-and-test
, so these defaults will be used as a fallback if no other method can be found for finding an impl/test file.There was a breaking change in #1734 (sorry!) which removed this fallback, so project types without a
src-dir
orrelated-files-fn
property wouldn't have a method for finding corresponding test/impl files, as shown in #1765. This fallback is not always particularly useful however, for example when your implementation file doesn't contain"src/"
, this PR throws an error in such cases.I've also tweaked some error messages around this area to hopefully make debugging a little easier:
"Project type foo not supported!"
"Cannot determine a test file name, one of "test-suffix" or "test-prefix" must be set for project type foo"
(or an equivalent message for test -> impl)projectile-create-missing-test-files
is not set"No matching test file found for project type foo"
"Determined test file to be "foo", which does not exist. Set `projectile-create-missing-test-files' to allow `projectile-find-implementation-or-test' to create new files"
src-dir
andtest-dir
are set for a project type, but the impl/test file does not contain these as substrings"Attempted to find a test file by switching this project type's (foo) src-dir property "src" with this project type's test-dir property "test", but foo/bar does not contain "src"
(or an equivalent message for test -> impl)Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
eldev test
)M-x checkdoc
warningsThanks!