-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Add multiple file creation with curly brackets pattern #162893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add multiple file creation with curly brackets pattern #162893
Conversation
@microsoft-github-policy-service agree |
1 similar comment
@microsoft-github-policy-service agree |
|
@microsoft-github-policy-service agree |
0bd36cd
to
47ca60b
Compare
This is very neat! Sorry about the angry bot. It makes me wonder if the logic should be expanded even further to support some of the filename expansion like in https://www.npmjs.com/package/brace-expansion |
Would these associated changes be available for extension authors? There are lots of extensions that create multiple-file templates for different situations. |
I think the answer to that at least in the near future is no. We are not even sure if we should take this in or leave it up to an extension. An extension can currently do this using the vscode filesystem APIs. The main reason it is being considered is because right now is that if you make a file |
Just to add some comments to the discussion, I do think it would be worth starting with very basic use cases since this is still considered a "niche" feature (similar to creating files in new folders i.e. I'd avoid getting too complex in supporting every expansion known as the cost might outweigh the benefit. |
Is this still relevant? |
Sometimes we need to create some files with little variations (same filename but with different extensions, same file in different directory, etc.). So I add the ability to specify these variation with curly brackets (like it can be done in bash for example).
Examples:
foo.{ts,css,spec.ts}
will create files:foo.ts
,foo.css
andfoo.spec.ts
{foo,bar}/foo.ts
will create files:foo/foo.ts
andbar/foo.ts
{foo,bar}/foo.{ts,css,spec.ts}
will create files:foo/foo.ts
,foo/foo.css
,foo/foo.spec.ts
,bar/foo.ts
,bar/foo.css
andbar/foo.spec.ts
To test this, you can create a new file and type a file name with a pattern like one of the examples above