Here's a problem I've been trying to solve for a very long time that has me completely stumped, so I'm hoping someone can help me out.
I am adding support for
AutoHotkey. It's a very cool automation macro tool that I use all the time.
The syntax is very C-like. Comments start with semicolons, and functions look a lot like C++ functions. A simple function with a stub of a
NaturalDocs style header looks like this:
;=============================================================================================================
; Func: WinGoto
; Activate a target window after starting the application if necessary.
;-------------------------------------------------------------------------------------------------------------
WinGoto(TargetWin, TargetRun, SendKeys = "", X = -1, Y = -1, Timeout = 30) {
return result
}
Basic procedure tagging is easy. I just built the usual
autohotkey_proc_search and
autohotkey_tag_case functions, and procedure tagging works fine. Had that working forever.
I wanted to add proper function help support so I could get parameter list tooltips and the like, so I thought it would be easy. I thought I could just use the existing C style code that's already there as is done for Java and C#. To test the theory, I just saved an AHK file with a .java extension, changed all semicolons to // and everything works great. Same goes for .cs, .c, .cpp - almost any of the curly brace languages seems to work, so I thought I could just leverage that.
I followed the pattern used for java, C#, etc. by adding these 2 functions, which I thought could do it:
int _autohotkey_fcthelp_get_start(_str (&errorArgs)[],
boolean OperatorTyped,
boolean cursorInsideArgumentList,
int &FunctionNameOffset,
int &ArgumentStartOffset,
int &flags) {
return _c_fcthelp_get_start(errorArgs,OperatorTyped,cursorInsideArgumentList,FunctionNameOffset,ArgumentStartOffset,flags);
}
int _autohotkey_fcthelp_get(_str (&errorArgs)[],
VSAUTOCODE_ARG_INFO (&FunctionHelp_list)[],
boolean &FunctionHelp_list_changed,
int &FunctionHelp_cursor_x,
_str &FunctionHelp_HelpWord,
int FunctionNameStartOffset,
int flags,
VS_TAG_BROWSE_INFO symbol_info=null,
VS_TAG_RETURN_TYPE (&visited):[]=null, int depth=0) {
return _c_fcthelp_get(errorArgs,
FunctionHelp_list,FunctionHelp_list_changed,
FunctionHelp_cursor_x,
FunctionHelp_HelpWord,
FunctionNameStartOffset,
flags, symbol_info,
visited, depth);
}
That's basically just cloning Java. When I execute
function_argument_help, I get a tooltip window with just the contents of the comment block as plain text (as expected), but I
don't get a list of parameters (See
image here.
I've done a bunch of things trying to get the parameters but come up short. I can get it work if I change the file extension to one of the well-known extensions, but I just can't seem to get it to work for the extension I have.
Could it be because the parameters are embedded in the tag file and I don't have it? It doesn't seem like it since it manages to read the comment from the buffer, but it's possible. I even tried cloning a bunch of other java functions without much success.
I'm kind of stuck here. Any ideas on how to proceed?