daidodo / format-imports-vscode

Format imports and exports for JavaScript and TypeScript in VS Code.
https://marketplace.visualstudio.com/items?itemName=dozerg.tsimportsorter
MIT License
62 stars 5 forks source link

Pattern specific configuration #75

Open I-Enderlord-I opened 2 years ago

I-Enderlord-I commented 2 years ago

In some of my projects there are special files (recognisable by their names) that always import certain base classes. I'd like to always have those at the top as a kind of header, but split into other groups in regular files.

I'd be helpful if one could create multiple configurations in the import-sorter.json file, which are selected based on regex matching of the file path. Possibly by optionally wrapping the configuration in a top-level array and adding an include option similar to the current exclude.

The alternative would be to change the tsImportSorter.configuration.configurationFileName setting in VSCode depending on those patterns, but microsoft/vscode#35350 might take some time.

daidodo commented 2 years ago

@I-Enderlord-I, thanks for the feedback!

Custom config based on source file paths are not supported ATM. But I can think of a few workarounds:

Please tell me if any of the above would help!

I-Enderlord-I commented 2 years ago

None of those are helpful in this specific context.