Skip to content
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

REFL008 adds using directive with improper line ending #228

Open
jnm2 opened this issue Mar 25, 2020 · 2 comments
Open

REFL008 adds using directive with improper line ending #228

jnm2 opened this issue Mar 25, 2020 · 2 comments

Comments

@jnm2
Copy link
Collaborator

jnm2 commented Mar 25, 2020

VS 16.5.0. Repro:

using System.Linq;
using System.Threading;

class C
{
    void M()
    {
        typeof(C).GetMethod(nameof(M));
    }
}

Apply the fix:

using System.Linq;
using System.Reflection;
using System.Threading;

class C
{
    void M()
    {
        typeof(C).GetMethod(nameof(M), BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
    }
}

Then save, close the file, and reopen:

image

Maybe it's using SyntaxFactory.LineFeed instead of SyntaxFactory.ElasticLineFeed? Though I would have expected the formatter to take care of both.

JohanLarsson added a commit that referenced this issue May 16, 2020
@JohanLarsson
Copy link
Collaborator

I tried a shot in the dark, changed from parsing the using directive to creating it via factory methods.
We can try to remember to keep an eye on things if this changed anything.

@JohanLarsson
Copy link
Collaborator

Using expect and formatter in the same sentence is brave!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants