Skip to content

Add a "Find Test/Implementation File" command that works like "Go to Test/Implementation" but opens file picker if no target file is found #4774

@incendial

Description

@incendial

Is your feature request related to a problem? Please describe.
I have two cases where the test folder structure does not match the src/ folder structure.

1) One of the intermediate folders was omitted (ex. instead of test/impl/another/** all tests are put into test/another/**). Which looks easy to fix unless you have 1000 tests that need to be updated + some test rely on the relative file paths which makes it a bit problematic. Although, I agree that it's mostly the consequences of my bad decisions and should not probably be covered by the extension feature.

However, while investigating this I figured out there is another case:
2) Let's say I have a list of similar classes located in classes/ (ex. classes/some.dart, classes/another.dart, etc.), but in order to test these classes I need some additional data that cannot be placed inside the test file, but is expected to be close to the test file in order to be easily updatable, avoid any potential cross-test dependencies and so on. So the test files are all placed inside their own directories "classes/some/", "classes/another", etc. with their test data being in a separate inner folder. This makes the folder structure asymmetrical between the implementation and test files and the only way right now to make the "Go To Test File" command to work is to place each implementation file in their own directory and having multiple directories with only one file complicates the project structure.

Describe the solution you'd like
A way for the "Go To Test File" command to be able to open test files do not have the exact match of impl file FS path.

Describe alternatives you've considered
Another command or any other way to achieve that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in commandsRelates to commands (usually invoked from the command Palette)is enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions