roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Directory separator does not work for .editorconfig

Open iskiselev opened this issue 2 years ago • 8 comments

Directory separator does not work correctly in .editorconfig section. Next does not work:

root=true

[generated/**]
generated_code = true

At the same time, next will work:

root=true

[generated**]
generated_code = true

Unfortunately, it is not so strict as first one - as will also apply generated to generated_not_really\somefile.cs

iskiselev avatar Jul 07 '22 23:07 iskiselev

Moving this to Roslyn as .editorconfig support is implemented by the compiler.

JoeRobich avatar Jul 08 '22 16:07 JoeRobich

@iskiselev / is used in .editorconfig in this repository and it's working as expected. Do you have a complete repro project where things don't work as expected? That will help investigating the issue.

Youssef1313 avatar Jul 13 '22 08:07 Youssef1313

Closing as the requested info hasn't been provided. If you can provide that info we will re-open this issue.

jaredpar avatar Aug 09 '22 17:08 jaredpar

Please clone https://github.com/iskiselev/style_issues/tree/d5cc8df239e28ec72f815690983029d946f9b781 Run dotnet build command. It will fail with ...\a\no_style\Test.cs(1,1): error IDE0161: Convert to file-scoped namespace Please check, that .editorconfig specify:

[{no_style/**}]
generated_code = true

So, it should ignore formatting in a\no_style\Test.cs. Please validate, that if you change section header to either ~~[no_style/**]~~, [{**/no_style/**}] or [{no_style**}] it will work correctly.

iskiselev avatar Sep 08 '22 06:09 iskiselev

@jaredpar , can you reopen it as I've provided example and caught some additional condition to reproduce it?

iskiselev avatar Sep 08 '22 06:09 iskiselev

It looks like [{no_style/**}] matches no_style folder in the current directory, but doesn't match no_style in a nested directory (e.g, a/no_style). This might be by-design, but @jaredpar can confirm.

btw, this has nothing to do with { }, so [no_style/**] will produce the same behavior.

I found that [{**/no_style,no_style}/**] works well.

Youssef1313 avatar Sep 08 '22 07:09 Youssef1313

@mavasani, @RikkiGibson

jaredpar avatar Sep 08 '22 23:09 jaredpar

Should it be reopen or it would be easier to open new issue to track it?

iskiselev avatar Sep 22 '22 00:09 iskiselev