Zinggi/UnrealScriptIDE — pull request #5 by Allar (2013-03-10 14:44:56+00:00)
Title: Added local variable lookup support

Been looking at this for awhile, decided to try it out, was saddened to
find class member auto-completion but no local auto-completion but love
what has been done so far, so I went ahead and added it.

My Python is a little rusty, and the ST2 API documentation is really
lacking to me, but maybe this is helpful?

I added an array to each Function to hold Variables local to that
function only. Similar to how "current documentation" is parsed, I added
a "current function" mechanic to the parser and call add_var on both
lines with "var" and "local" as their first keyword.

add_var now has an optional function_name and if supplied, will add the
variable to the function. I believe there are some inheritance issues
with your current get/add_func setup but because UC doesn't support
same-named functions with different signatures, this issue is very
limited in scope. A parent class may inadvertently have local variables
present in sub-class overrides added to it due to this issue if my
understanding is correct.

I reordered some get/set accessor declarations in
UnrealScriptAutoComplete so set accessors can reference get accessors
without error.

Added helper get_current_function to retrieve the function the cursor is
immediately below, but does not currently check if between the white
space of two functions.

When building the auto complete list, all functions are now iterated
through regardless of b_only_var when set (may cause a slight
performance issue in cases where b_only_var was set previously) but I
feel this trade off was worth it to allow local variable function lookup
with simpler code and less logic.

I tried adding conforming code and comments according to the current
style, if there are any stylisic errors, please point them out and I'll
be glad to conform.

Thanks Zinggi for getting what has been done done so far and putting it
out for the public!