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

Generate field/property should not place the new member with an #if #25988

Open
aelij opened this issue Apr 6, 2018 · 1 comment
Open

Generate field/property should not place the new member with an #if #25988

aelij opened this issue Apr 6, 2018 · 1 comment
Labels
Milestone

Comments

@aelij
Copy link
Contributor

aelij commented Apr 6, 2018

Version Used: 15.6.4

Steps to Reproduce:

class C
{
    private int _x;
#if DEBUG
    private int _y;
#endif
        
    public C(int z)
    {
        _z = z;
    }
}
  1. Place cursor at _z and click Ctrl-.
  2. Select Generate field _z

Expected Behavior:

    private int _x;
#if DEBUG
    private int _y;
#endif
    private int _z;

Actual Behavior:

    private int _x;
#if DEBUG
    private int _y;
    private int _z;
#endif
@CyrusNajmabadi
Copy link
Member

Note: It should place it in a compatible ifdef region if that's what sort of region it is in when you invoke the feature. for example:

    public C(int z)
    {
#if DEBUG
        _z = z;
#endif
    }

That said, we have almost no effort spent in the language service to try to do this kind of fine-grained analysis. About all we do is try to ensure that we don't accidentally move things around that overlap ifdefs, and that we do not try to remove parts of an ifdef.

@gafter gafter added the Area-IDE label Apr 9, 2018
@jinujoseph jinujoseph added this to the Unknown milestone Apr 22, 2018
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

4 participants