codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.89k stars 356 forks source link

miss option multi-line-comments in “Insert blank line before“ config #910

Open a44281071 opened 2 years ago

a44281071 commented 2 years ago

Environment

Description

Is an option missing in “Insert blank line before“ config? option name: multi-line-comments

Steps to recreate

  1. use ctrl+M,/ open setting window.
  2. change to "Clean - Insert" tab.
  3. Insert blank line before
  4. missing option: multi-line-comments

Current behavior

        public bool HasItems { get; }
        /// <summary>
        /// multiline comments
        /// </summary>
        internal async Task<DateTime?> GetCurrentPlayTimeAsync()
        {
        }
        /// <summary>
        /// multiline comments
        /// </summary>
        internal async Task<DateTime?> GetCurrentPlayTimeAsync()
        {

Expected behavior

        public bool HasItems { get; }

        /// <summary>
        /// multiline comments
        /// </summary>
        internal async Task<DateTime?> GetCurrentPlayTimeAsync()
        {
        }

        /// <summary>
        /// multiline comments
        /// </summary>
        internal async Task<DateTime?> GetCurrentPlayTimeAsync()
        {
codecadwallader commented 2 years ago

Thanks for opening the issue. In that example the multi-line comments are attached to the method, and if the option to insert blank line padding before methods is enabled it should(tm) follow the expected behavior. It would also kick in if the option to insert blank line padding after properties is enabled. Does that help?

a44281071 commented 2 years ago

Do not append new line:

public int Id {get; set;}
public string Name {get; set;}

Append new line:

public int Id {get; set;}

/// <summary>
/// multiline comments
/// </summary>
public string Name {get; set;}
codecadwallader commented 2 years ago
/// <summary>
/// multiline comments
/// </summary>
public string Name {get; set;}

Is considered a multi-line property and will be affected by the option "Insert blank line padding before multi-line properties".

The original example was a method.