Open ivan-mogilko opened 5 months ago
I've been playing with Autocomplete (of AGS Editor) and recently with the Watch Variable panel in VBA (in Excel) and had an idea of offering the autocomplete that we can get in the line of the script that is on break (is this line known anywhere?) on the typing box we get in the watch variable. The idea came to me because the watch pane in VBA also doesn't have autocomplete and after using it for a bit for an issue at work I reminded that the one in ags also didn't have.
that we can get in the line of the script that is on break (is this line known anywhere?)
Sort of, this line is known from the message that comes to Editor each time after a break or step. This message contains a callstack, with script/line pairs. I don't think if it's currently saved anywhere except for the Callstack panel.
Uhm, ok, so the issue here is if we want to have that specific line in autocomplete, so we can have all the local variables, the way to do requires we have access to the ScriptEditor, which both the script and the line will be get in the ZoomToFile call here
So what I can do is at some point here pass the script name and line to the watch panel (or somewhere else?), and then I can get this from there. I thought to do it even in that NotifyWatchVariables but I am unsure how to pass arguments and how that works - all these calls use those "invoke" which I know are needed for Winforms stuff but I don't understand how they work (are they async?).
And then having such info I can then know when someone is typing in watch variable which script and line should the autocomplete show relative to, and then I can pickup this from the corresponding scintilla wrapper instance. I need to play more with this before I have anything...
I suppose, there could be a event named, as an example, OnScriptDebugPosition. This event could be located somewhere in GUIController, Debugger or other global manager. This event would be fire when: a) break point happens; b) step in script happens; c) script position is selected in Callstack window. (question is how to make callstack window trigger this event)
Any panel, such as WatchVariables window, would be able to subscribe to this event, and update itself upon receiving it.
WatchVariables would likely need to save "current debug position" for any future value updates.
I think C is not needed as the local variables shown there won't be in scope (for the engine internally I think), so we won't be able to read from there.
Regarding B, I thought that when a step is done the engine throws a break itself.
I think C is not needed as the local variables shown there won't be in scope (for the engine internally I think), so we won't be able to read from there.
True, this is for the future, when engine supports backtracing callstack (task number 6 in this list).
This is a list of potential fixes and improvements copied from #2430 discussion.