Closed MarkJohnstoneGitHub closed 5 years ago
There are two ways to parameterize an annotation
'@Annotation "argument"
Or
'@Annotation("argument")
The grammar can probably be improved to be more flexible, but space+( in VBA is suspicious any way and honestly I think I'd be reluctant to make space+( not break anything. It breaks the attributes because parens aren't legal in attribute value expressions.
Space+( has a tendency to show up in other places too:
MsgBox ("thing")
...and while that doesn't break anything, the parens aren't doing what people think they do.
Thanks for the reply. Would expect an RD error for illegal annotation with space before then the bracket then rather attempt to insert the Attribute causing a compiler error.
It's easily avoided was just confusing why RD would behave that way.
I think we could just put a whitespace?
into the grammar rule and then it should work as expected.
The whitespece was OK already. The actual problem was the order in the alternatives for annotationArgList
: the ons without parens came before the ones with and matches using a parenthesizedExpr
to match the argument including the parentheses as argument.
I just had to change the order.
Rubberduck version information Version 2.4.1.4627 OS: Microsoft Windows NT 10.0.17134.0, x64 Host Product: Microsoft Office x64 Host Version: 16.0.11727.20244 Host Executable: MSACCESS.EXE
Description An issue with Rubberduck fixing, adding a missing attribute, where space is before the opening bracket. After RD fixing the annotation, it produces a compile error due to the attribute being displayed in the code pane.
Eg. After RD fixing the attribute: '@Description ("Function description.") Public Function MyFunction() As String Attribute MyFunction.VB_Description = ("Function description.") End Function
Exporting the class it appears ok. When I restart the MS Access Application the attribute shows up still in the code pane.
If I manually remove the offending: Attribute MyFunction.VB_Description = ("Function description.") Then export it the description attribute has been removed.
To Reproduce '@Description ("Function description.")
Expected behavior Description annotation to be added as when there is no space between the '@Description and the opening bracket.
Screenshots