roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

EditorConfig comments cannot follow a property value

Open sharwell opened this issue 4 years ago • 9 comments

Related to editorconfig/specification#23 and editorconfig/specification#31

Fixes #44596

⚠️ This is a breaking change for users who previously wrote comments at the end of lines in .editorconfig. I wasn't able to find a specific example but @Youssef1313 found this one:

https://github.com/dotnet/roslyn/blob/7464573942d364bc8a33c04ec46ac5835e3d90ba/src/Features/Lsif/Generator/.editorconfig#L4-L5

💭 I do notice that all cases we've found that seem to be affected involve a dotnet_diagnostic line. Since this is a compiler-controlled property interpretation, we do have the option of modifying the interpretation of that value to ignore text after a ; or #.

sharwell avatar Mar 03 '21 15:03 sharwell

Needs a parallel change in roslyn-analyzers:

roslyn-analyzers already doesn't follow the spec, so I'd rather delete the custom support there than try to maintain it.

sharwell avatar Mar 03 '21 16:03 sharwell

Just saw Jon's comment above. I'll mark this PR as draft for now. Did we start a conversation to confirm the desired behavior?

jcouv avatar Mar 23 '21 19:03 jcouv

Lets not merge this until we get confirmation that this is actually the correct behavior. There seems to be some belief that this is a spec defect

@jmarolf @jcouv @sharwell The spec is now updated https://github.com/editorconfig/specification/pull/31 and it's clear what the correct behavior is.

Can this get reviewed and merged?

Youssef1313 avatar Jan 01 '23 07:01 Youssef1313

Any progress on this? This issue makes inserting the GPL license text impossible as it gets truncated.

AnalogFeelings avatar Jan 05 '24 04:01 AnalogFeelings

Few popular repositories that are going to be affected:

  • https://github.com/xamarin/xamarin-android/blob/aaa37c3df94490ee9befb8381f4dd7aa18226355/.editorconfig#L218
  • https://github.com/DotNetAnalyzers/IDisposableAnalyzers/blob/c8e3f323ff7d31d8271c9a013f1932d6f743e2de/.editorconfig#L207
  • https://github.com/dotnet/project-system/blob/7ab8083659d0d54722463aab3990efaf37b4d894/.editorconfig#L232

Note that none of these will be affected now that dotnet_diagnostic.*.severity parsing has been updated to ignore text that was previously a comment.

sharwell avatar Jan 08 '24 21:01 sharwell

Overall though I love the approach to maintain compat -- simply treating this as a break would have been far too icky for these scenarios.

jasonmalinowski avatar Jan 19 '24 02:01 jasonmalinowski

Any movement on this?

Delsin-Yu avatar May 20 '24 08:05 Delsin-Yu

What's the status of this PR? Since the PR documents the breaking change in .NET 9, is it safe to assume it will be merged for that release?

raulsntos avatar Aug 24 '24 23:08 raulsntos

@dotnet/roslyn-compiler for a second review. Thanks

jcouv avatar Oct 16 '24 20:10 jcouv

@dotnet/roslyn-compiler for a second review. Thanks

jcouv avatar Oct 30 '24 16:10 jcouv