File template with a variable in file name

Hello.

I want to recreate this VS2022 extension in my current Rider based setup.For example:

I want to create a new file, by providing the name “Foo”. I expect a file FooCommand.cs to be created. And the content should look something like that:

using Some.Example;

using <current-dir-namespace>;

public record <name-provided-earlier>Command(<cursor-can-be-placed-here>) : IExampleInterface;

As far as I know, there is no possibility to recreate the functionality of creating multiple files but, it would also be a nice thing in case of recreating such an extension.

0
1 comment

It's possible to achieve with the IntelliJ Platform integrated Velocity template engine

In Settings | Editor | File Templates | Other Languages, create a new file template as below.

using Some.Example;

using ${PROJECT_NAME};

public record ${CommandName}Command(#[[$PARAMETER$]]#) : IExampleInterface;

The template generation could be looked as below.

0

Please sign in to leave a comment.