mikededo / dartBarrelFileGenerator

VSCode extension that generates barrel files for Dart projects
MIT License
25 stars 9 forks source link

works incorrectly if filename and directory name are the same #55

Closed murataksuu closed 2 years ago

murataksuu commented 2 years ago

If I have a file directory like this:

mikededo commented 2 years ago

Thanks @murataksuu! 👋🏼

Yep, this is the default behaviour of the extension! I'm currently working in a new feature (see #54) in which I will add a configuration option that will allow you to choose the default name to use whenever a barrel file is created.

If this new feature is not enough, I remind you that you have the promptName configuration (see the docs). This configuration, if active, whenever you are creating a barrel file will prompt you with an input allowing you to type the name you want for the barrel file.

Aside from that, there's no other option to fix this problem. That's out of my scope, but from my point of view, I would not name the files with important content as index.dart. But as I said, it is something I should not worry about; just a recommendation.

I will close the issue as I propose a solution in #54, since they are extremely related. Feel free to re-open if necessary! 💪🏼

murataksuu commented 2 years ago

Thanks for the quick response.

The promptName property works just fine. But the problem here is that the plugin changes the content without any warning. I think if the folder name and file name are the same, the extension should give a warning or ask us to enter a file name. Also, the promptName property is not enabled by default. This may cause developers to discover this feature after a bad experience.

Thank you.

mikededo commented 2 years ago

Hm, true. I will think about it. If I come up with a solution I will create an issue and tag you in! 😃