Monday, June 20, 2005

Ah, jeeves, you've gotten it!

I think I've finally figured out the strategy for Visual Studio's 'complete word' functionality.

If the character before the caret is a '.' (or has non-whitespace characters leading up to a '.') then do a regular member look-up.

However, if not, then insert a new string literal based on a randomly selected GUID (so you never hit a 'valid' string literal), and once you hit that string literal start working your way back up the chain.

If you're in a method, grab the locals first.

If not, go up to the parent node, grab its INamespace and probe it for its members. Go up (again) and probe, et all, until there is no more (aka, something explodes).

Always make sure that OnImport is passed through cleanly (mark'em to grab their members later).

There's just one problem: this does not allow for 'context sensative' code completion like C# does. I think I can work around this by checking to see if the parent node is a generator, class definition, struct definition or etc, then doing the special voodoo magick.

I freaking love that Boo has its own AST available like this: I know *nothing* about this sort of programming work but Boo makes it a FREAKING BREEZE.

No comments: