« first day (169 days earlier)      last day (3011 days later) » 

00:13
WOW. VBA appears to be one of a few things that's way better on Windows than Mac ;)
That window there is THE ENTIRE "IDE"
OK maybe not
00:46
Ohhhhhh yeah!
None of the windows dock on Mac @Phrancis.
It's because the part that makes them dockable is in the Win API.
I could actually kind of dig that on multiple screens though.
@Phrancis your function is returning a Variant ;)
And will happily take anything for a Width
So there's no "main window" for the VBE?
There kind of is, hold on
So, it has some of the same stuff, just looks way different.
It's also not showing as stand-alone program, instead it is tied to Excel, so if you go back to Excel to test it, you have to re-click Editor to open it up again.
Making Alt Command-Tab impossible
HAHA It works!
On the flip side, I can use the awesome Monaco font
2
@RubberDuck what does?
@Mat'sMug The custom config.
01:09
oh... I never doubted it
Neither did I, but after fighting with the windows for so dang long.... =;)-
//todo: store GUID in a const so if it needs to be changed it can be changed once??
@Mat'sMug Like this color scheme better? =;p
hmm
@RubberDuck
    [ComVisible(true)]
    [Guid(ClassId)]
    [ProgId(ProgId)]
    public partial class DockableWindowHost : UserControl
    {
        public const string ClassId = "9CF1392A-2DC9-48A6-AC0B-E601A9802608";
        public const string ProgId = "Rubberduck.DockableWindowHost";
@Mat'sMug I don't even know if that's possible with attributes.
01:15
^^ works
Oh, seriously? That's cool man.
So, to do the com visible == false, do I need to include System.Interop.Runtime in all my files?
I might as well set things up correctly before I submit the pull request.
well I just replaced all internal with public and a ComVisible(false) attribute...
mind if I push and you can sync/merge before the pull?
Nope. That's cool. I've got clean up to do first anyway.
What are you guys making in that repo?
An add-in for the VBA IDE
01:24
What is it for?
it's eventually going to parse your VBA code, inspect it, and issue recommendations (and could automatically do them)
Well, so far we've built a task list that picks up comments from your code, and Mug built a Unit Testing framework.
If you click on an item in the task list, it will take you directly to that line of the code too.
I can't believe neither of you guys changed the font to Consolas or Lucida Console yet. I got tired of Courier after like an hour
2
01:27
lol I keep it... for nostalgy I guess
We're vba devs, we like pain.
2
Important design decision.. I might not have done the right thing.
what's up?
Does sound like a useful thing you're making though
gotta admit that Consolas does look better
I'm loading the Configuration object in the App and passing just what is necessary through each constructor. That way the file only needs to be read from once, unless a change needs to be made.
Right call?
01:30
@RubberDuck that doesn't work for me... what the..
For example:
    public ToDoItemsMenu(VBE vbe, AddIn addInInstance, Config.ToDoListSettings settings)
    {
        _vbe = vbe;
        _addIn = addInInstance;
        _settings = settings;
    }
@Mat'sMug double click?
Really?? Ummmm okay...
works in the TestExplorer though
Works on my machine??? Not sure how I'm going to fix it unless I can repo.
01:33
I'll try to get it to work before I push
any reason why SubClassingWindow is private?
(just going through ReSharper flags)
            //destructor
            ~SubClassingWindow()
            {
                ReleaseHandle();
            }
~ << syntax for destructor
bye-bye comment ;)
@Mat'sMug Because I'm afraid to mess with the MZ Tools guys code...
ah
right
Ahhh come on! I've never seen a destructor in C# before. lol
lol
not needed very often
I imagine IDisposable has something to do with that.
01:41
sometimes.. TBH I don't know exactly when a destructor is in order. But COM interop has something to do with it for sure... along with IDisposable
FYI dockable windows still work and I've tweaked MZ Tools code :)
[StructLayout(LayoutKind.Sequential)]
private struct Rect
{
    public int Left { get; set; }
    public int Top { get; set; }
    public int Right { get; set; }
    public int Bottom { get; set; }
}
^^ was a private struct with internal fields
i.e. fucking awkward
Whatever. So long as it doesn't break again.
I'm not ready to mess with it again. Not quite yet.
ok so I've changed all internal to public, and added a ProgId and ClassId public string constant to both classes that need them, replaced the hard-coded attribute values with the constants.
and everything still works ;)
and pushed
I'm cleaning up all the junk the IDE created when I deserialized. I'll reset my master branch, merge into there, and then push.
01:56
that I-don't-know-what-language-it-is grammar you linked to yesterday really makes me wonder if I can actually succeed with my current approach.
> Fear is the mind killer. The little death that brings total oblivion. I will let the fear pass over me, and through me. When the fear is gone I shall turn my mind's eye to it's path and only I shall remain.
~The Litany of Fear
Man, speaking of fear, I always get nervous when a merge fast forwards when I don't expect it to.
And @Mat'sMug, if all else fails, you already built the best unit testing framework for VBA.
lol probably
(cough)
off some duck's original VBA code
(cough)
Yeah. So we'll just keep kicking ass.
ok. So I'll just keep implementing ISyntax, and I'll wonder what to do with Expression nodes later.
if anything it's just not going to be the fastest VBA parser ever built. but it's going to work.
it. is. going to. work.
ok the VBAGrammar class is starting to annoy the heck out of me.
Then do something else for a bit. =)
02:07
but it defines things like IdentifierSyntax which I don't want to copy/paste in 20 different places
I guess it's just going to have to stay
@RubberDuck well I already started implementing a ForLoopSyntax class...
Really? Nice.
I'll be done in like 5 minutes
BBL, going to friend's house to drink beer and work on music :D
later!
Toodles!
02:11
lol
phone whistles.. let me guess, did a pull request just come in?
> An error occurred. Detailed message: 1 conflict prevents checkout
better than last time :)
ugh. I always search 10 minutes for where to go to resolve conflicts...
ah, was my ForLoopSyntax
damn I don't know how to work. work in a branch, damn mug!
Maybe. =)
02:28
@RubberDuck what's that smell?
    [ComVisible(false)]
    public class ForLoopSyntax : SyntaxBase
    {
        public ForLoopSyntax()
            : base(SyntaxType.HasChildNodes)
        {

        }

        protected override bool MatchesSyntax(string instruction, out Match match)
        {
            match = Regex.Match(instruction, VBAGrammar.ForLoopSyntax);
            return match.Success;
        }

        protected override SyntaxTreeNode CreateNode(Instruction instruction, string scope, Match match)
        {
            return new ForLoopNode(instruction, scope, match, new List<SyntaxTreeNode>());
^^ ForLoopSyntax
vv IfBlockSyntax
    [ComVisible(false)]
    public class IfBlockSyntax : SyntaxBase
    {
        public IfBlockSyntax()
            : base(SyntaxType.HasChildNodes)
        {

        }

        protected override bool MatchesSyntax(string instruction, out Match match)
        {
            match = Regex.Match(instruction, VBAGrammar.IfBlockSyntax);
            return match.Success;
        }

        protected override SyntaxTreeNode CreateNode(Instruction instruction, string scope, Match match)
        {
            return new IfBlockNode(instruction, scope, match, new List<SyntaxTreeNode>());
I think I need to put this up on CR before I go any further.
Oh god. It's like looking for Waldo.
The differences. It's like looking for Waldo.
    [ComVisible(false)]
    public class TypeConversionSyntax : SyntaxBase
    {
        protected override bool MatchesSyntax(string instruction, out Match match)
        {
            match = Regex.Match(instruction, VBAGrammar.TypeConversionSyntax);
            return match.Success;
        }

        protected override SyntaxTreeNode CreateNode(Instruction instruction, string scope, Match match)
        {
            return new TypeConversionNode(instruction, scope, match);
        }
    }
they're all like that
each SyntaxBase implementation is nothing but "tell me what regex to use and what type of node to create"
That's okay. I can't really wrap my head around how to decouple the todocontrol from the refresh logic.... it relies on a code module. It's coupled there and I don't see how to break it.
That sounds like a job for functional programming.
Maybe.
02:33
Func<string,bool> _matchesSyntax; Func<Instruction,string,Match,SyntaxTreeNode> _createNode;
might work
except I have the parser looping through implementations of ISyntax
I might have fucked up ..big time.
at least the code is dead stupid simple
should be an easy refactor
@RubberDuck uh
uhhhh what?
what if the config file doesn't exist?
add-in fails to load :(
Okay. I'll find a way to gracefully handle it. For now copy the rubberduck.config file from the resources folder.
shouldn't it be in \roaming?
Should it?
Yeah. I guess it should. Shouldn't it.
02:40
%appdata% seems to point to it
Yeah. It should use the roaming profile. It should be available on any machine it's installed on.
Shouldn't take long to fix.
For loops parse
now ForEach
you know what? the SyntaxBase smell might not be too bad actually. It's pretty freakin' easy to implement a new syntax+node
the longest part is to come up with the regex
        public static string ForEachLoopSyntax
        {
            get { return @"For\sEach\s" + IdentifierSyntax + @"\sIn\s" + ReferenceSyntax; }
        }
oh, bug
Next works
Next element doesn't end the block
...and puts the remainder of the module as child nodes of the ForEachLoopNode
hmm...
            while (index < lines.Length && !result.EndOfBlockMarkers.Contains(lines[index].Content.Trim()))
and the LINQ code that would work, is illegal syntax, because index is a ref parameter.
bingo
I'll implement the DoLoopSyntax (do/while/until...loop) and While...Wend, and then I'll implement the literals - StringLiteral, DateLiteral, ...all these things I saw in that VB6 grammar
03:23
You're a brave soul Mug. I couldn't ever dream of doing what you're doing.
Okay. Fixed the first issue. It'll use a default configuration if the file isn't found now.
Now I just need to switch to the roaming profile.
03:38
hey @Phrancis
Yo
Just broke out the computer at my friend's place
Why? =)
Well, I need it for music =;p
Ahhhhhh well then. All right.
Stack Overflow You've earned the tag badge
03:53
@Mat'sMug Which one?
lol bronze
Still a damned accomplishment the way they vote.
it's actually my first tag badge on SO I think
yeah it is
I need to spend a little more time on CR though. I don't like how my SO rep is gaining faster than my CR rep.
had to be
03:57
I don't think I've answered any other languages....
 
1 hour later…
05:00
I'm fried. TTGTB
Yeah. I hear ya.
0
Q: Custom Task List

RubberDuckI've been working on a COM Add-in for the VBA IDE with a friend. The idea is to search the active VBA Project for "magic" comments and create a task list much like any sane IDE would have. This is my first "real" project in C#, so I'm feeling like this code could be better. The code below is al...

05:18
@RubberDuck ^
Holy shite Mug... Wow man.
getting somewhere
:)
: LineNumber is the last line of the instruction. I expected it to be the first.
it should be StartLineNumber and EndLineNumber, not just LineNumber
Option Private?
Option Private Module
> Note Option Private is only useful for host applications that support simultaneous loading of multiple projects and permit references between the loaded projects. For example, Microsoft Excel permits loading of multiple projects and Option Private Module can be used to restrict cross-project visibility. Although Visual Basic permits loading of multiple projects, references between projects are never permitted in Visual Basic.
I don't quite get what it does. They're private by default already.
05:29
> When a module contains Option Private Module, the public parts, for example, variables, objects, and user-defined types declared at module level, are still available within the project containing the module, but they are not available to other applications or projects.
it's like auto-converting Public to Friend basically
Hmmm. Interesting.
Still no idea.... OH! Regular modules! Duh duck!
lol
I wonder if it can be used to.. hold on
yes!
if you have public functions/subs in a std module with Option Private Module, the procedures aren't exposed as Excel user-defined functions!
that's... very useful actually.
Want some SO points??
make a Q+A about that?
1
Q: Add user-defined function (UDF) to built-in category in Excel

mwolfe02When I add a public function to a standard code module in Excel it shows up in the Insert Function wizard in the catch-all category "User Defined." Is there any way to: Keep the function public (so it may be called from other modules) but hide it from the Excel function wizard? Make the functi...

05:34
2
Q: Hide VBA procedures from Excel application but not from other projects

Bjørn H. SandvikI know this is a long shot, but with the limitations in "Option Private Module" and even worse "Private Sub/Function", does anyone know if there is a way of hiding VBA procedures from the Excel application but not from other projects? I have an XLAM with a subset of reusable functionality that I...

>
When I add a public function to a standard code module in Excel it shows up in the Insert Function wizard in the catch-all category "User Defined."

Is there any way to:

Keep the function public (so it may be called from other modules) but hide it from the Excel function wizard?
0
A: Add user-defined function (UDF) to built-in category in Excel

retailcoderPut Option Private Module at the top of your module. Done. http://msdn.microsoft.com/en-us/library/aa266185(v=vs.60).aspx

Hmmm. I already voted on that one. Wonder when? Lol
Idk. Night Mug. The duck needs some sleep.
night! I'll just implement OptionSyntax and commit and then merge your PR... and then go to bed
oh, and I'm adding Option Private Module to generated TestModules :)
 
8 hours later…
13:53
I'm starting to think that I don't care if it's coupled... MVP is to make presenter logic portable. I don't where that logic will ever be needed some place else. Until then, I think it may be a YAGNI scenario.
Then again..... it bugs me...
14:49
We'll see what comes out of CR ;)
Having presentation handled as a concern of its own can make it easier to expand UI later on
15:10
I did take care of the case sensitivity issue.
But I need to put it down for a while. ttyl buddy
 
1 hour later…
16:22
Didn't bring the laptop :(
16:47
Poor guy. =(
Hey! Wait a second! I wonder if there's an ICodeModule interface available...
Make one!
I mean, you can wrap the code module with an interface
The implementation will have a CodeModule dependency, but not the abstraction; then code can depend on that abstraction and not care about the underlying CodeModule
Heh..... CodeModule is the interface.
CodeModuleClass is the concrete implementation.
So, my code is already more testable than I thought it was.
17:06
Interesting
Depends if you want the Vbe.Interop dependency to reach the presentation code
Imagine the UI is in a separate assembly
Idk. I just know that now I'm convinced that I do need to decouple the presenter logic from the view so that it can be unit tested.
 
1 hour later…
18:38
We need a bunch of extension methods to extend SyntaxTreeNode and flatten the tree, perform recursive searches, etc. I'm thinking of one that returns an IEnumerable<string> containing all comments in the tree. and one returning an IEnumerable<Identifier> to return all identifiers.
Actually perhaps return IEnumerable<Instruction> so we can locate the node in the actual code
I thought extensions were for cod e you don't have access to?
Wouldn't they just be methods of the SyntaxTreeNode?
Anyway, we can mock the VBE.
namespace RubberduckTests.Mocks
{
    class MockVBE : VBE
    {
        public CodePane ActiveCodePane
        {
            get
            {
                throw new NotImplementedException();
This works, and everything just became very testable.
I guess they could
Nice!
I'm not going to implement everything yet. We'll just implement as we need the different components in testing.
It's been bugging me that we have a unit testing framework that isn't itself really under test. =)
18:53
lol yeah
Heard of Moq?
You don't need to implement the mocks manually, a mocking framework can do it for you!
What's Moq?
A mocking framework :)
Gotta run, ttyl
> you use lambda expressions to represent the methods and properties that you want to mock.
fml
19:14
lol
Okay. I've got it installed. I'm going to give it a shot.
Say you need to access ActiveCodePane in a unit test; you'll want myVbeMock.ActiveCodePane to return a mock CodePane, so myVbeMock.Setup(x => x.ActiveCodePane).Returns(myMockCodePane) where myMockCodePane is another mock object that only implements what you need for the test, say Lines - myMockCodePane.Setup(x => x.Lines).Returns(someCode) where someCode is a string[] with some stub code
So you don't need to implement the whole interface, you just setup the mock to return whatever it is that your test needs
And then the code being tested will call the mocked members, and you can then verify, say, that such or such method was effectively called with the expected parameters
It only works with interfaces though (and maybe abstract classes, not sure)
@RubberDuck got it through NuGet?
Yes @Mat'sMug. I used NuGet.
Perfect
At one point I'll add the Ninject NuGet package, and go full-blown DI. The composition root shall be in the Extension class, at the entry point. But I want to implement first and refactor after; I don't want to force a design, I want the design to emerge by itself as we decouple the components :)
Going offline for a while, have fun!
19:31
See ya buddy!
 
4 hours later…
23:34
Okay @Mat'sMug next pull request is really just a bunch of clean up. Should be the last one for a little while. I need to go off and build the GUI for the settings.

« first day (169 days earlier)      last day (3011 days later) »