rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.91k stars 300 forks source link

Indenter gives wrong indentation when functions are invoked in multiline method calls #3981

Closed JKAbrams closed 6 years ago

JKAbrams commented 6 years ago

Consider this example (which represents the expected result):

Sub createDiagram()
    Dim dimensions As typeDimension
    dimensions = createDiagram(Title:=Translate("diagram_unique_profiles"), _
                               doColor:=True, _
                               showLegend:=True)
End Sub

Actual result after indentation:

Sub createDiagram()
    Dim dimensions As typeDimension
    dimensions = createDiagram(Title:=Translate("diagram_unique_profiles"), _
                                                doColor:=True, _
                                                showLegend:=True)
End Sub

So it seems like the indenter tries to indent to the last opened parenthesis, but in this case it misses the closing of the parenthesis of the Translate function call.

Vogel612 commented 6 years ago

Seems like a carry-over bug from the original SmartIndenter code.

comintern commented 6 years ago

Turns out this is completely unrelated to the function call passed as a parameter. The issue is the underscores in "diagram_unique_profiles". Fix inbound.