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.92k stars 302 forks source link

Self-closing parentheses not working with Call #4554

Closed fafalone closed 5 years ago

fafalone commented 5 years ago

The parentheses autoclose doesn't work when you use it with Call e.g. x = func() works, func nestedfunc() works, but Call func() not only does not work, you can't even type an opening (.

V2.3.0.4221 VB6 SP6, Confirmed on Win7 and Win8.

Vogel612 commented 5 years ago

AFAIK (and please do correct me if I'm wrong) Call isn't strictly necessary to invoke Subs and Functions. Rubberduck even has an inspection that flags usage of Call. As such I'd consider this somewhat lower in priority. Removing Call should be a functioning workaround.

Thank you very much for the bug report :+1:

retailcoder commented 5 years ago

The thing is, this issue was caught in pre-release, and fixed, with a unit test to cover it.

Is the VB6 IDE behaving differently than VBA here? If not then this is a regression bug. The fix was to bail out & let the keypress through when the VBE decided to remove the () autocode.

I'll re-test this in the VBA IDE later today & follow-up.

MDoerner commented 5 years ago

I think this kind of regression was introduced when the double opening parentheses bug was fixed. The key press is swallowed now.

However, the actual bug is somewhere else. SCP does not try to enter the pair of parentheses if it is at the end of a line, assuming the VBE will eat it. That is a wrong assumption in an explicit call statement. The logic has to be enhanced to consider this.

retailcoder commented 5 years ago

Repro confirmed.

Version 2.3.0.4221 OS: Microsoft Windows NT 6.1.7601 Service Pack 1, x64 Host Product: Microsoft Office 2010 x86 Host Version: 14.0.7212.5000 Host Executable: EXCEL.EXE

retailcoder commented 5 years ago

@MDoerner bang on.