codemaid icon indicating copy to clipboard operation
codemaid copied to clipboard

Codemaid removing whitespaces on XML Comments inside <code> tags

Open Ksdmg opened this issue 3 years ago • 4 comments

Environment

  • Visual Studio version: 2019 Professional
  • CodeMaid version: 12.0
  • Code language: c#

Description

Codemaid is removing leading whitespaces when providing code examples in XML comments.

Steps to recreate

Add an XML comment with code example:

    /// <summary>
    /// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
    /// <code>
    /// this.PropertyChanged?.Invoke(this, args);
    /// </code>
    /// </summary>
    /// <example>
    public class BindableBase : INotifyPropertyChanged

Current behavior

I have Codemaid automatic cleanup on document save enabled. This removes leading whitespaces on code examples. This is especially annoying when providing longer code examples.

    /// <summary>
    /// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
    /// <code>
    ///this.PropertyChanged?.Invoke(this, args);
    /// </code>
    /// </summary>
    /// <example>
    public class BindableBase : INotifyPropertyChanged

Expected behavior

Codemaid should retain a leading whitespaces to show intendation on code.

    /// <summary>
    /// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
    /// <code>
    /// this.PropertyChanged?.Invoke(this, args);
    /// </code>
    /// </summary>
    /// <example>
    public class BindableBase : INotifyPropertyChanged

Ksdmg avatar Nov 18 '21 16:11 Ksdmg

Thanks for reporting the issue. I wasn't able to reproduce it. Could you please include an export of your CodeMaid settings?

codecadwallader avatar Nov 19 '21 13:11 codecadwallader

@codecadwallader , thanks for the response, here is the config file CodeMaid.txt .

Ksdmg avatar Nov 22 '21 08:11 Ksdmg

Ok, thanks for the configuration. I discovered the reason I couldn't reproduce it was because the trailing unmatched <example> tag above was throwing things off. If I remove that I can reproduce the issue with default settings.

    /// <summary>
    /// <code>
    /// this.PropertyChanged?.Invoke(this, args);
    /// </code>
    /// </summary>

@w5l If you have a chance would you mind taking a look? This sounds familiar.

codecadwallader avatar Nov 30 '21 13:11 codecadwallader

#707

clazarr avatar Feb 02 '24 22:02 clazarr