You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My 2 cents: since the - is already handled as a standard character in the case above, I don't think we need to worry about escaping it. It makes sense to me to escape only the things that would be considered as special characters by editorconfig itself otherwise and - is not one of those.
the - is already handled as a standard character in the case above
@captainsafia I don't think this is correct. The string builder used in the case above holds the Regex pattern that will be used for matching section names. The - has special meaning in Regex. So I'd expect a file called "A-Z.cs" to have an issue, since the generated regex will potentially look for a single uppercase letter from A to Z instead of the literal "A-Z". But will need to confirm before doing the change.
I dug more into this. Since the - has special meaning only between [ ] in section name, and since GenerateMSBuildEditorConfig task won't add un-escaped [ ] in section name, there is no need to escape the dash. Closing.
The
-
character has special meaning, which I think will need to be escaped as well. It's not specified in editorconfig docs, but used in Roslyn. See:roslyn/src/Compilers/Core/Portable/CommandLine/AnalyzerConfig.SectionNameMatching.cs
Lines 306 to 310 in 481529a
Related to #52515
FYI @captainsafia
The text was updated successfully, but these errors were encountered: