ReSharper 2024.3 Help

File Header Text

ReSharper options: Code Editing | File Header Text

This page of ReSharper options allows you to specify a default file header that ReSharper will insert as a comment into C# or C++ files when you apply Code Cleanup with a profile that allows inserting and updating file headers or when you create a new file from template.

You do not have to include comment delimiters in the file header text. ReSharper will automatically insert proper delimiters for the specific language when the header template is applied.

File header text

This field contains plain text with optional variables that will be added at the beginning of files and wrapped in comment delimiters.

List of macros

The macros displayed to the right of the file header text have rather self-explanatory names. You can use them in the header text to keep it up to date without manual changes. Click a macro to insert it in the header at the current caret position.

Embrace File Header into Region with Name

Name for a region that the file header will be wrapped up with. If this field is left empty, file header is not surrounded by a region.

File header start detection regex

When applying file header template, by default ReSharper will automatically detect initial comments in the file, if any, as an existing file header and replace them with the specified file header.

If you want to restrict this behavior and only consider specific comments as file headers, edit the regular expression in the File header start detection regex field. For example, you can change it to Copyright .* to match only initial comments starting with Copyright.

If you want to reuse the existing header that was matched by the regular expression, add the ${OldHeader.Text} macro in the desired position within the file header template.

File header variables

In this tab, you can specify constant values to be reused in the header text. For example, you can add a variable with the name companyName and the value My company, and then use it in the header template as $Variable.Named(${myCompany}).

Last modified: 11 February 2024