Skip to content

Improve C# statement deletion clean up #1192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JohnEfford opened this issue Dec 19, 2022 · 2 comments
Closed

Improve C# statement deletion clean up #1192

JohnEfford opened this issue Dec 19, 2022 · 2 comments
Labels

Comments

@JohnEfford
Copy link
Contributor

JohnEfford commented Dec 19, 2022

Clean up not removing empty lines:

Clean up removes trailing spaces for deleted statement but not trailing new lines, so for the code:

public void DeletionStatement()
{
    var a = 10; //This statement has trailing comment
    Console.WriteLine("Badger");
    if (1 == 1) //kdkdkdk 
    {
      Console.WriteLine("In If");
    }
    var b = 20; var c = 30;
}

Current correct space trailing space deletion:

Deleting statement var a = 10; using "chuck state red" removes the space between the statement and its trailing comment, and deleting var b = 20; using "chuck state vest" gives

public void DeletionStatement()
{
    //This statement has trailing comment
    Console.WriteLine("Badger");
    if (1 == 1) //kdkdkdk 
    {
      Console.WriteLine("Badger");
    }
    var c = 30;
}

Incorrect line deletion current behaviour:

But deleting statement Console.WriteLine("Badger"); using "chuck state ..." leaves an empty line:

public void DeletionStatement()
{
    var a = 10; //This statement has trailing comment

    if (1 == 1) //kdkdkdk 
    {
      Console.WriteLine("In If");
    }
    var b = 20; var c = 30;
}

Likewise deleting the if statement leaves:

public void DeletionStatement()
{
    var a = 10; //This statement has trailing comment
    Console.WriteLine("Badger");

    var b = 20; var c = 30;
}

Desired Behaviour

Where the commands should leave:

public void DeletionStatement()
{
    var a = 10; //This statement has trailing comment
    if (1 == 1) //kdkdkdk 
    {
      Console.WriteLine("In If");
    }
    var b = 20; var c = 30;
}

and

public void DeletionStatement()
{
    var a = 10; //This statement has trailing comment
    Console.WriteLine("Badger");
    var b = 20; var c = 30;
}

respectively.

@pokey
Copy link
Member

pokey commented Jan 2, 2023

Fwiw we will probably handle this one in a generic fashion via #855

@JohnEfford
Copy link
Contributor Author

That looks like it closes this issue then.

@pokey pokey closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants