ASFG
Auto Structured Folder Generator
⭐ Introduction
If you have a large number of folders that need to be created for frequent repetition or conventions, this extension can be useful to auto-completed folder structures and files based on pre-determined settings.
⭐ Functions
1. Generate structure from a command palette
1. cmd + shift + p
2. Input 'asfg' and press 'enter'
3. Select structure you want to make
2. Generate structure on a specific folder
1. Right click on a target folder
2. Click asfg context menu
3. Select structure you want to make
3. Register a code snippet and Apply
// 1. Register
1. Drag the target code block + right click
2. Choose "(asfg) register snippet"
3. Input the snippet name
// 2. Apply
1. Left click the postion you want to place the snippet (make cursor) + right click
2. Choose "(asfg) apply snippet"
3. Select the snippet you want to apply
Case 1 : if there is no asfg.config folder
If there is no "asfg.config" folder on the workspace root and when you input the "asfg" command on the command palette, you have the two options.
- "make exmaple folder structure" : this option create a sample structure.
- "make example config" : this option create a sample asfg.config folder that stores a custom folder structure shape.
😉 if you select the "make example config" option, it would add ignore sentence for asfg.config folder automatically
Case 2 : if asfg.config folder exists
If there is a "asfg.config" folder, it collects structure definitions from a "config.json" file inside "asfg.config" folder. It means the json key becomes a select menue.
Here is an example result if you make config setting required.
As you expected if you select the one, our "asfg" will generate folder structure accoring to the definition you write in the config.json.
⚠️ Note!
source and destination are a relative path started from "asfg.config" folder. It means that asfg will find a source structure from "path/to/you/project/asfg.config/{target source folder name}" and so is definition.
But if your creation is started from "specific target folder", "asfg" will destine the definition started from that folder.
For example, if you right-click the "components" folder and select "asfg", it means that the destniation path is "parent/directory/components/{your destination path}" like below
>
So, if you set the destination is like "../hooks"
and you right-click the folder "components"
, the creation path is "to/your/project/components/hooks"
case 3 : Create structure starting from a particular folder
As you can see above, maybe you hope to create your own structure not from a root workspace but from a folder you choose. If so, you can use asfg context menu by right click.
The only thing you have to do is hover your cursor, right click, and click asfg context menu. Then asfg will open the select menu and if choose one, it generate structure based on the folder you choose.
case 4 : Placeholder
If you hope to set specific placeholder to change your filename and content dynamically, you can use "placeholder" option.
To use it, please follow the step
🚶 1. set "placeholder" property in the config.json
The placeholder must be an "string array"
🚶 2. set placeholder to a target name or content
If you want to use placeholder inside the content, please follow this name format {filename or placeholder}.{file extension}.txt
🚶 3. activate the asfg command
Then, if you select the asfg command with placeholder option, placeholder input will be popped. you can type the value and asfg changes all placeholder to the value you set
>
🤖 Note!
If you hope to use single placeholder set for multi-generating structure, then you can use the first "single" placeholder set like below.
The only thing you have to do is just set the placeholder array on the first array element. Then, others will follow the first placeholder set.
this functionality is very simple. Just block the code, register name, and apply that