Default "Using" namespace imports, and Templates in General

Answered

Is there a way to cause Rider to include "using" statements for a list of namespaces, such as System and System.Collections.Generic, in every new code file by default? 

I tried using the templates from (context) -> Add -> Edit File Templates, but I ran into several problems with this:

  • I don't see a way to insert the proper namespace statement based on folder nesting into a .cs file template
  • The newly created .cs files are created on the filesystem and added to source control, but not added to the project or given a compile mode
  • Rider doesn't use my template for files created automatically, such as when I use the move refactor to send an inner class to a new file.

Am I doing something wrong? Is there some other way to get the IDE to include packages by default? 

 

0
1 comment

Unfortunately, Rider 2018.1 doesn't have such opportunity, it was implemented in Rider 2018.2. You can download the latest EAP build here and configure C# class template via "File | Settings | Editor | File Templates | C#". It's worth noting that Rider 2018.1 honors file templates configured in Rider 2018.2.

Hope this helps!

0

Please sign in to leave a comment.