« first day (1269 days earlier)      last day (231 days later) » 

12:00 AM
[rubberduck-vba/Rubberduck] 6 commits. 5 opened issues. 6 closed issues. 13 issue comments. 829 additions. 301 deletions.
> Is this in any way enforced? Is there a consensus?
hey @AnnaVel you still with us? How's it going?
12:16 AM
@Vogel612 sounds good =)
> There were talks of using xml-docs in the source code to generate the user documentation contents. I think that's the best way to do it. Needs quite a bit of work on the RD-Web repo then, and proper & complete xml-doc on all inspections, quickfixes, refactorings,... And basically all commands.
12:34 AM
@M.Doerner / @Mat'sMug Until/unless we find a way to find the type of a document module, what do you think about an annotation like: '@Me: Workbook As Excel.Workbook? RD could then know what Me is, and that Workbook_Open is an event procedure, and usages of Name are references to `Workbook.Name'.
3 hours later…
3:41 AM
@ThunderFrame I don't understand. ?TypeName(Sheet1) and ?TypeName(ThisWorkbook) returns correct type. So what's stopping us exactly from assigning the correct type to the document module?
@this How do we get a reference to Sheet1/ThisWorkbook?
Q: How do I know that `ThisWorkbook` is a `Workbook`?

Mat's MugI'm working with the VBIDE API, and can't assume that the host application is Excel, or any Office app either. So all I know is that I'm looking at a VBComponent, and that its Type is vbext_ct_document. In the VBE's immediate pane I can get this output: ?TypeName(Application.VBE.ActiveVBProjec...

Grok the problem now
3:56 AM
closest we came up with, IIRC, is: If VBProject.VBComponents("thisworkbook").Properties("Parent").Value("Name").Value = "Microsoft Excel" Then ProgID = "Excel.Workbook"
> F5 and Unit tested.

This is the second half of the Rubberduck folder. Folder `API` through `ToDoItems`.
but that would require lots of host-specific checks
Yeah, that was discussed in that SO you linked to.
and I'm not a big fan of that.
4:52 AM
> Is there anything else I ought to revert?
5:31 AM
5:52 AM
huh, I din't expect this, but I guess it makes sense?!?
'Declared in ThisWorkbook
Sub test()
Debug.Print ObjPtr(Me), ObjPtr(ThisWorkbook)
'Prints: 889866008 1027696720

Debug.Print Me Is ThisWorkbook
'Prints True
End Sub
6:03 AM
Might be the fact that it's predeclared.
since predeclared has to be allocated, outside the VBA code, it's different.
If you try this with a UserForm or anything else that's predeclared, I suspect you'll see the same behavior.
I do have to admit, it's very weird to see the Is operator returning true even though the pointers don't agree. I always thought the Is operator was basically checking the pointer's value. Obviously it's doing a bit more than just that.
6:15 AM
@this that makes sense
6:31 AM
Just wondering -- did we ever consider using netoffice PIAs?
6:41 AM
Duck check: github.com/rubberduck-vba/Rubberduck/blob/next/… where there is commented code. Should this code be left there or cleaned out?
1 hour later…
8:02 AM
@this There's various discussions in chat hoistory and the GitHub issues, but 1704 is probably the best reference
4 hours later…
11:44 AM
that should be all
12:21 PM
Regarding identifying document modules, the solution proposed in the SO answer is implemented hallways at the moment. The problem is that the way the COM collector currently exposes the CoClass we cannot identify the methods. Thus we are comparing the properties against the properties plus the methods, which cannot work.
12:39 PM
Plus, we're not collecting the properties that are defined using the old IDL method.
1:18 PM
If we could separate the methods, that might already do the trick for some document types. Unfortunately, I have no idea how the COM reflection part of the code base works.
@M.Doerner IKR, I looked at adding the legacy property types, and quickly got lost in a rabbit hole.
There's also the memory structures behind the Project Explorer's Treeview Item's UserData/lparam pointers. Those pointers give me 23 further pointers, which in turn lead to more pointers. And some of those pointers lead to things like a GUID for the project, and the offset into VBRuntime library. I'm hopeful that somewhere in the mix, I can find a GUID for the document modules, and maybe other useful stuff.
But it's hard reverse engineering all that, so I'm building a tool to assist.
And re parsing the FRM files, it seems the MSDN documentation only covers about 25% of the syntax that is actually possible.
4 hours later…
5:32 PM
Hey guys, I have a question
I see some files that start with a commented area that states it's generated by a tool, so any changes won't be saved once it's generated again
like for example the Rubberduck.Parsing.Grammar.VBAParser.cs
How are these files generated?
these specifically are generated by ANTLR
How, on every build they're generated again? Is it possible to re-generate them?
we feed VBALexer.g4 into ANTLR and use the files generated by that as well as VBAParser.g4 into ANTLR again to get VBAParser.cs
@NelsonVides not on every build.
at least not those specific ones. The `Designer.cs' files are generated by VS every build.
the ANTLR files are manually rebuilt.
Designer.cs, where can I find an example of those?
and the ANTLR, how can I rebuild it?
@NelsonVides RubberduckUI.*.resx are used to generate RubberduckUI.Designer.cs
What are you working on? The Grammar is fiendishly hard to get right.
5:39 PM
oh yes it is. I'm just curious about everything, just sounding out the terrains and having a feel of how it works
right now I just updated ANTLR to 4.6 and I'm seeing what got broken (many things!), that way I get to know the internals by smashing myself to them
Hosch said he'll tackle the upgrade later this month when he's on vacation
I'm gonna follow all of his changes when he does so :D
6:22 PM
[rubberduck-vba/Rubberduck] build for commit 2a21d5cf on unknown branch: AppVeyor build succeeded
@NelsonVides Currently, we are on Antlr 4.3, which cannot be built in VS2017. However, it can be built in VS2015, which cannot build the solution. So any grammar changes have to be done in VS2015 atm and then one has to switch back to VS2017 to actually build the solution.
@M.Doerner, that's interesting. Why only VS2017 can build Rubberduck?
Somehow, our grammar does not build correctly with version 4.6 of Sam Harwell's antlr version. So we will switch to the official version, which exists since 4.5.
We use C#7, which the VS2015 compiler does not understand.
Ah, C#7, that's an easy answer, thanks
About the grammar... that's weird, I wonder why
But the official version apparently requires Java, isn't it?
In short, ANTLR is java-based, yes.
Sam's version let us build the classes without java
The "official" version that @M.Doerner referred is to use java to build C# files
which is a very bad news for CI process.
(not that we're including it in CI but if we wanted... oh boy.)
6:37 PM
They have a C# runtime, but the generation of the lexer and parser happen in a Java application.
@M.Doerner any thoughts on my modifications to the installer?
Even with Sam Harwell's version, including the parser generation in the build process causes a lot of problems.
I had totally forgotten about that.
No worries. just wanted to be sure I got it right, or if I could do better. One thing I do have to do is to see if I can come up with interfaces but I'm not at the point to define interaces so for now the For() and ImplementedBy() uses the same concrete types.
I see, some tests are not passed and far too many are skipped...
why does it skip tests?
6:55 PM
It does not really skip the tests, well except the about 50 ignored tests. They return in the state inconclusive because the actaul functionality could not be tested due to a parser error.
almost 90, actually..
Unfortunately, inconclusive tests are displayed the same way as ignored ones.
@this Since the implementing type in the first registration is not generic, it does makes sense. In the second, you can drop the IimplementedBy; without it it binds to itself. In the third one, I guess you wnat a transient auto-magic factory, because that is what you get with this registration.
Duck check. Is there any preference for LINQ Query syntax or Method syntax?
7:04 PM
@IvenBach IIUC, It gets compiled to Method syntax either way, and RD style preference is for Method syntax.
@M.Doerner yes, for this
Different question for anyone who can answer... I see that IRefactoring does not have a validation method, forcing the commands to answer the CanExecute. Does anyone else think it really should be the refactoring class's responsibility to determine if it can be executed or not? I'm in another passing-the-buck situation due to the need to share validation results to the refactoring.
Thanks Thunder. R# suggested Query syntax and I'm not familiar with LINQ to convert it to Method on my own. I'll do some reading and make the attempt later today.
@M.Doerner actually I realized - do I really want a transient factory? Since it'll be same, singleton would suffice?
Personally, I find query syntax only useful in the cases where the corresponding method syntax uses multiple lambda expressions.
Mar 31 '15 at 3:37, by Mat's Mug
^^ let has no equivalent that I know of with method syntax
7:09 PM
@this I guess, it could be a singleton.
The only reason to make it transient would be that you plan on disposing the factory after some work has been done in order to release all objects created by it.
Well, you can emulate a let with a select and an anonymous type.
However, the let is more convenient, indeed.
7:36 PM
@M.Doerner This would be several => nested uses of the lambda operator?
There are some LINQ operators that need three or four lambdas.
huh, you can override the event object for Sheet1 and break the event handlers - once we work out what the event object is, we might need an inspection for that:
Private WithEvents Worksheet As StatusBar

Private Sub Worksheet_Change(ByVal Target As Range)
  'Just a normal procedure, as statusbar doesn't have Change event
End Sub
8:00 PM
return block != null && block.children != null && ContainsExecutableStatements(block); is suggested to replace with return block?.children != null && ContainsExecutableStatements(block); This may cause problems because of the short circuiting of block != null?
If the changed were to be done then ContainsExecutableStatements(block) could be supplied with a null? Is my understanding correct?
no it's not.
because block?.children will return null if the block is null as well.
which then correctly short-circuits as it would have before
8:20 PM
Ok. I’ve still a lot to learn about null coalescing and short circuiting both
8:30 PM
right ... more prodding to do ...
@Mat'sMug ~prod ;)
8:44 PM
prods, ducks
9:05 PM
About those ignored tests, I'll revisit those on my vacation.
They are a bunch of condition ones.
Also, @Vogel612, just to make sure you got my comment, block?.children?[0]?.Value will return null if block is null too.
yes, I noticed the comment:)
Cool :)
Also, I'm going to work on RD this vacation, but then I think I'll step back.
I've got other technologies I'd like to/need to learn, and they don't lend themselves to RD that well (unless you guys don't mind if I heavily extend the website).
And work's environment doesn't really lend itself to experimenting because my whole VS instance is tied up with TFS.
Even when I don't have any TFS repo open...
I suppose I could disconnect and reconnect, but I'd probably have to re-download the solution every time then, because it would forget the mapping...
9:19 PM
Hmm. One'd think git and TFS works independently
But then again, I gave up on VSTO's team explorer long ago because it wanted to know too much.
Well, they could probably be forced to work together, but it's a pain, anyway.
Time I don't have to burn. :P
or you can simply skip it all by using something like TGit. :p
9:42 PM
@this how's it going on the Extract Method front, btw?
as you might seen above, I'm trying to clean up the mess that was the old method and finding it's not very compatible with how we usually do with other refactoring.
for example, other refactorings don't have any validation -- most of their CanExecute implementation is simply a hard-coded true
but we have a validation process (which is working BTW)
but to make it complicated, it already has the metadata that is useful for the model
so I need to take the metadata to help popuplate the model
Right now, I'm doing this all "wrong" --- using public fields on the Refactoring class to get what I need
once I have a working process I will circle back and refactor it out
for the moment, i just need to get model correctly populated with all the metadata I have from the validation.
@Vogel612 I likely won't have the time for it today :-/
BTW, ATM whenever I do it wrong, I'm leaving behind TODOs so I know where to clean when it comes.
10:01 PM
So, all I need to do is merge into Master and it builds? I can do that.
What about the code metrics one?
I setup the PR, and it's fine, other than a few merge commits master doesn't have, so I can't merge without doing a PR from master to next first.
IIRC, Mat can merge anyway, though.
it's still missing i18n
Ah, so we need him anyway.
OK, it'll automatically update when stuff is merged into Next, though.
[rubberduck-vba/Rubberduck] build for commit bc12cf4e on next: AppVeyor build succeeded
we mustn't forget to update the "version" in appveyor.yml
Didn't Vogel's PR close #3563, too?
10:19 PM
@Hosch250 quick on the draw about minor-releasing there :)
oh no wait ... 2.1.1 it is ...
[rubberduck-vba/Rubberduck] build for commit 9a46e6eb on unknown branch: AppVeyor build succeeded
Should the 2.1.1 include IvenBach's 2 PRs?
shouldn't really matter. I'd prefer to keep those for after the functionality change PRs
because possible conflicts are most likely easier to resolve on the "simple" changes
aside from that it shouldn't make a difference, so we might as well, IMO
10:42 PM
can someone please remind me the best way to get declarations out of a context or a selection? I'm looking at the DeclarationFinder but it doesn't seem to do what I need to get
check Declarations.References and find those where the Context is inside your Selection
sorry but where would one get Declarations from? I have the RubberDuckState which gives me a DeclarationFinder but not a Declarations, and AllUserDeclarations doesn't seem to have a References either?
AllUserDeclarations.SelectMany(d => d.References)
^^ should do the trick already
doh. was too literal and looking for a class Declarations with a References property.
thanks for the nudge
11:17 PM
@this No.
I've had several bad experiences merging things that "shouldn't break anything" in.
(Especially with JS, which this fortunately isn't.)
I'd rather have those taken for a spin by the devs first.
@this Please note that AllUserDeclarations on the RubberduckParserState literally is DeclarationFinder.AllUserDeclarations.
So i'm clear - what is the difference between a ParentScopingDeclaration and ParentNonScopingDeclaration ?
They are usually the same.
Parent non-scoping should be the parent in code structure, IIRC.
The scoping one definitly defines a scope in VBA.
Parent scoping should be a parent in code structure, but not necessarily the first parent.
Take that with M.Doerner's statement, and it's pretty much it.
11:27 PM
The thing is that I really do not know which declarations that are not scopes can have child declarations.
I don't remember offhand either, and I don't know VBA well enough to say.
@Mat'sMug might know.
The only scopes there are are global, project, module and procedure, IIRC.
I don't know. Maybe something like a C# using block, or something?
Do we have a declaration for that?
Because that wouldn't be a scope in VBA.
It also is not a declaration in C#.
Sure it would be.
11:31 PM
@M.Doerner that is correct. Then there's EnumMember and UdtMember under Enum and UDT declarations
using (var foo = something.SomethingElse())
FWIW, this is the expression i ended up, thanks to Vogel's help... var references = _state.AllDeclarations.SelectMany(d => d.References.Where(r => r.IsSelected(selection)));
Smallest scope is procedure level in VBA
(needed all, not just users)
@Mat'sMug That makes sense. The enum is the non-scoping parent of its members and teh scope is the module.
11:31 PM
in my ultra simple test, both gave me the same answers.
but I'll go ahead with the "Scoping" rather than "Non"
since I want the procedure
@Hosch250 foo is a declaration, the using is not.
Well, we could have hacked it up like that :P
Because we don't have anything else to represent structures in a useful manner.
Best make our representation as close as possible to the actual language structure
11:34 PM
hmm. just to confirm - is it possible to have a statement with no declarations at all?
Which is why we've got to parse our CST into an AST at some point.
@this If 2 + 2 = 4 Then
aren't those declarations, "2", and "4"
LOL, no.
They're literals
11:35 PM
No, literals are not declared.
thought we collected them as unresolved declarations or something.
We are not doing Ruby.
And a statement is shown by the braces in this: foo = {2 + 3}
hmm that might be a problem. I shouldn't be assuming I will have declarations in a selection.
@this LOL, no.
That would be foo = 2 + 3, where foo wasn't Dimed anywhere.
11:36 PM
the only reason I wanted declaration was I figured it'd give me easy way to get the parent scope without mucking in the parse tree
Actually, the selection could be all whitespace.
You can't.
@M.Doerner Correct.
@M.Doerner yes, it could be but it should be invalidated
@this Nope. Which is why we need an AST--so you can "muck in the parse tree" and keep your hands clean.
I'm already past that point, so we have to assume we have a valid selection on something.
oh well. At least I have the contexts
I guess I'll have to get my hands dirty in the tree then.
11:38 PM
@this Have fun.
Be sure to account for all the various types of whitespace and statement separators and line continuations :)
See you, @M.Doerner.
pretty sure don't have to.
I have unit tests for the crappy selections with whitespace & continuations and I can check using contexts only.
@this feel free to make the context classes implement whatever interface you deem necessary to achieve this =)
I might end up doing that yeah
but for right now, i'm going to run around the codebase buck naked until I get it working the way I need it, then I'll encapuslate it.
that's funny - a cautionary tale in where to place breakpoints.
11:54 PM
LOL, the good old screen-blocker :)
Stepping out now.

« first day (1269 days earlier)      last day (231 days later) »