ManuelGil / vscode-auto-barrel

Auto Barrel is a Visual Studio Code extension that helps you to create and maintain barrel files in your project.
https://marketplace.visualstudio.com/items?itemName=imgildev.vscode-auto-barrel
MIT License
7 stars 1 forks source link

Consider barrel files in recursive folders #4

Open apollox opened 2 months ago

apollox commented 2 months ago

Is it possible to extend the feature of recursive folder detection, that it also consider existing barrel files in the recursive folders? This would simplify the barrel files, especially in higher hierarchy levels and there are less file changes in a commit because only the nearest existing index.ts would be change with the command Update Barrel and not all in the folder tree.

Example structure

Current 'shared/index.ts'

export * from './model/address';
export * from './model/person';
export * from './model/user';
export * from './service/person.service';
export * from './service/person.service';

Current 'shared/model/index.ts'

export * from './address';
export * from './person';
export * from './user';

Expected 'shared/index.ts'

export * from './model';
export * from './service';
ManuelGil commented 1 month ago

Hi @apollox,

Apologies for the delay.

I've been looking into the development of this new feature, but I don't see a straightforward path to implementing it. The challenge lies in handling file searches recursively, which would add complexity to the code. This could also introduce unintended side effects, especially for projects using frameworks like Next.js.

Currently, there's already a configuration option (autoBarrel.files.disableRecursiveBarrelling), that manages recursion. However, implementing this feature would require adding a new setting to toggle between these configurations.

Given the potential complications and time constraints, I regret that I’m unable to commit to delivering this update at the moment. As an alternative, I recommend exploring other extensions that might meet your needs.

Thank you for your understanding.