How do I allow a semicolon in the file_header_template of editorconfig

Viewed 367

Our file header should have a semicolon (;) in the text. But it seems that the ; will be read as comment in the .editorconfig.

For example, this works:

.editorconfig:

; Top-most EditorConfig file
root = true
[*.cs]
file_header_template = a,b,c

Add -> Class, will generate:

// a,b,c

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NLog
{
    class Class1
    {
    }
}

But when using the semicolon:

.editorconfig:

; Top-most EditorConfig file
root = true
[*.cs]
file_header_template = a;b;c

Add -> Class, will generate:

// a

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NLog
{
    class Class1
    {
    }
}

I expected // a;b;c and not // a

How could I fix this? Is there a work arround?

I tried already (some are really non-sence):

  • escaping the ; with a backslash
  • escaping the ; with another ;
  • put the value in single or double quotes.

I think this is a Visual Studio 2019 bug, as the specs say:

Comment: starts with a ; or a #.

Inserting a # or ; after non-whitespace characters in a line (i.e., inline) shall neither be parsed as a comment nor as part of the section name, pair (defined below) key or value in which it was inserted. This may change in the future; thus, is not recommended.

0 Answers
Related