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

VB -> C#: Fix casing #258

Closed
mrmonday opened this Issue Apr 5, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@mrmonday
Copy link
Contributor

commented Apr 5, 2019

Please prefix the issue title with either "C# -> VB: " or "VB -> C#: " if relevant

Input code

Public Class Class1
    Sub Bar()

    End Sub

    Sub Foo()
        bar()
    End Sub
End Class

Erroneous output

public class Class1
{
    public void Bar()
    {
    }

    public void Foo()
    {
        bar();
    }
}

Expected output

public class Class1
{
    public void Bar()
    {
    }

    public void Foo()
    {
        Bar();
    }
}

Details

Product in use: VS extension

Version in use: 6.6.0

Visual Basic is case insensitive. When converting code to C#, it should fix the casing of method calls, properties, etc.

@GrahamTheCoder

This comment has been minimized.

Copy link
Member

commented Apr 5, 2019

Thanks for all the reports. I'll look into them more carefully soon. They appear to have good repros - the effort is much appreciated. Let me know if you're interested in tackling any of them - I'm happy to assist in learning.

@mrmonday

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

Extra case:

Public Interface I
    Public Function Foo() As Integer
End Interface
 
Public Class C
    Implements I
 
    Public Function foo() As Integer
        Return 0
    End Function
End Class

mrmonday added a commit to mrmonday/CodeConverter that referenced this issue Apr 8, 2019

@GrahamTheCoder

This comment has been minimized.

Copy link
Member

commented Apr 8, 2019

Thinking about this, we might get a lot of the way there with a small tweak to ConvertIdentifier to check the case of the symbol:

var symbol = _semanticModel.GetSymbolInfo(id.Parent).Symbol;

There may well then be a long tail of edge cases that circumvent that path, but it'd be a good start.

@mrmonday

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

Ha, you made that comment just as I opened a PR doing just that ;)

mrmonday added a commit to mrmonday/CodeConverter that referenced this issue Apr 8, 2019

GrahamTheCoder added a commit to mrmonday/CodeConverter that referenced this issue Apr 8, 2019

GrahamTheCoder added a commit to mrmonday/CodeConverter that referenced this issue Apr 8, 2019

GrahamTheCoder added a commit to mrmonday/CodeConverter that referenced this issue Apr 8, 2019

GrahamTheCoder added a commit to mrmonday/CodeConverter that referenced this issue Apr 8, 2019

GrahamTheCoder added a commit to mrmonday/CodeConverter that referenced this issue Apr 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.