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 299 forks source link

SCP adds extra parentheses after function name when there's a trailing space #5022

Open daFreeMan opened 5 years ago

daFreeMan commented 5 years ago

Rubberduck version information

Version 2.4.1.4734
OS: Microsoft Windows NT 10.0.15063.0, x64
Host Product: Microsoft Office 2016 x64
Host Version: 16.0.4849.1000
Host Executable: EXCEL.EXE

Description A space after a Function name and before the opening paren causes fun results.

To Reproduce Steps to reproduce the behavior:

  1. Begin a new function declaration: Private Function foo | (note the space after foo)
  2. Type (
  3. End up with Private Function foo() ()
  4. See error

Expected behavior There should not be 2 sets of parens inserted by SCP. This appears to be a fun edge case caused by a trailing space after the function name.

Screenshots These screenshots show what happens as I Ctrl-Z to undo the changes made by SCP, in case that's useful. 2019-06-26 09_54_59-Microsoft Visual Basic for Applications - Satisfaction Summary Master v3 34 - De 2019-06-26 09_55_12-Microsoft Visual Basic for Applications - Satisfaction Summary Master v3 34 - De 2019-06-26 09_55_29-Microsoft Visual Basic for Applications - Satisfaction Summary Master v3 34 - De

Logfile RubberduckLog.txt

retailcoder commented 5 years ago

Pretty sure SCP is only adding one pair - and the VBE is responsible for adding another. Respectively:

Public Function Foo()(|)
                   ^^ VBE
                     ^^^ SCP