Create custom multi-file items in VS Code, with variable name support!
- Define the templates in your
settings.json
file. All templates need a name and their corresponding items, together with an optional description.- Variables are supported using
$
followed by a number (so all occurrences of$N
will be replaced by theN
th argument you provide during item creation).
- Variables are supported using
"addmultifile.templates": [
{
"name": "React Component",
"description": "Item for a React component and its styles",
"items": ["$0/$0.tsx", "$0/$0.styled.ts"]
},
{
"name": "Test suite",
"description": "Item for a unit test",
"items": ["test-$0/$1.ts", "test-$0/$1.test.ts"]
}
]
-
To create a new multi-file item, right click on the respective folder (just as you would for creating a new file or folder) and select "New Multi-File Item...":
-
Select the item you want to create (if you only configured one template, it will be used by default).
-
If applicable, input the template's arguments, separated by spaces.
-
Done! Your custom multi-file item should be created :)