Further DebugConsole improvements

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Further DebugConsole improvements

#1 Post by yufra »

I want a place to organize my thoughts and get feedback on the in-game DebugConsole.
  1. Check for `userdata` when doing tab auto-completion
  2. Auto-complete paths (identify a path by a string starting with a "/" character?)
  3. Add more keyboard shortcuts (candidates)
  4. Fix history position (should be at the end) after re-opening the DebugConsole
<DarkGod> lets say it's intended

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: Further DebugConsole improvements

#2 Post by tiger_eye »

4. upon bringing up the lua console, arrow-up should scroll commands beginning with the previous command, and arrow-down should scroll through commands beginning with the very first one.
darkgod wrote:OMFG tiger eye you are my hero!

Canderel
Sher'Tul
Posts: 1252
Joined: Mon Nov 24, 2003 2:31 pm
Location: South Africa

Re: Further DebugConsole improvements

#3 Post by Canderel »

Flashing cursor...

Display the parameters for a function... almost like "help"... (Ctrl-space in a lot of IDE's these days)

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: Further DebugConsole improvements

#4 Post by edge2054 »

delete!! I use delete more then backspace generally.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Further DebugConsole improvements

#5 Post by yufra »

Canderel wrote: Display the parameters for a function... almost like "help"... (Ctrl-space in a lot of IDE's these days)
Implementing this could be very tricky indeed. My first thought is to leverage the Luadoc stuff, but I have no idea how to go about doing that. It would be nice, though...
edge2054 wrote: delete!! I use delete more then backspace generally.
Yup that will definitely be done.
<DarkGod> lets say it's intended

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Further DebugConsole improvements

#6 Post by yufra »

Alright, here is what I have managed thus far:
  1. Ctrl+A (Home), Ctrl+E (End), and Delete commands added
  2. Blinking cursor position
  3. Path auto-completion
  4. Check for table during auto-completion (fixes tab on userdata)
A help command would be nice, but not going to get done soon. The scroll commands one is surprisingly odd... not sure what is happening there yet. Anyway I have pushed my changes to a Gitorious branch so if you guys can check it out and give feedback I would appreciate it. Cheers!
<DarkGod> lets say it's intended

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Further DebugConsole improvements

#7 Post by yufra »

Lies, all lies. Make that one lie. Adding a help feature is going to be very easy and I have it nearly completed. I would appreciate suggestions on the interface for it, though. Here are some examples with the cursor denoted by the "|" character:
  1. game.zone:addEntity|
  2. game.zone:add|Entity
Now say you hit Ctrl+Space for help. In case (1) the comments for the Zone:addEntity function will be returned. In case (2) should we return help? Or say "game.zone.add is not a function"?

Also, what should the output look like? I am planning on doing something like this:

Code: Select all

<<< Help found in /mod/class/Actor.lua line 527 >>>
--- Setup minimap color for this entity
-- You may overload this method to customize your minimap
function _M:setupMinimapInfo(mo, map)
<DarkGod> lets say it's intended

Canderel
Sher'Tul
Posts: 1252
Joined: Mon Nov 24, 2003 2:31 pm
Location: South Africa

Re: Further DebugConsole improvements

#8 Post by Canderel »

1) is obviously great. Does it give me te parameter names?
2) i think should auto-complete. ie the same as tab, then once chosen do no 1

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Further DebugConsole improvements

#9 Post by yufra »

Canderel wrote:1) is obviously great. Does it give me te parameter names?
I am not entirely certain what you mean by "parameter names". The last line of the help output will show the actual function definition, so you can see what the function expects there. Some of the function comments also have parameter explanations, for example this would be the help for engine.Actor.move:

Code: Select all

<<< Help found in /engine/Map.lua line 152 >>>
--- Moves an actor on the map
-- *WARNING*: changing x and y properties manually is *WRONG* and will blow up in your face.  Use this method. Always.
-- @param map the map to move onto
-- @param x coord of the destination
-- @param y coord of the destination
-- @param force if true do not check for the presence of an other entity. *Use wisely*
-- @return true if a move was *ATTEMPTED*. This means the actor will probably want to use energy
function _M:move(x, y, force)
This shows the function definition on the last line, and has some comments about the individual parameters above. The comment on parameters and return values are often missing in the code, but they should be documented and you can bring up ones that need it as you poke around.
2) i think should auto-complete. ie the same as tab, then once chosen do no 1
Fair enough.
<DarkGod> lets say it's intended

Canderel
Sher'Tul
Posts: 1252
Joined: Mon Nov 24, 2003 2:31 pm
Location: South Africa

Re: Further DebugConsole improvements

#10 Post by Canderel »

Yeah, just after I posted I saw you added docs up to the full declaration of the function. But was on the phone, so edit is too much hassle. :-/

Great work I must say! That thing is already so awesome it's not even funny. :D

Get DarkGod to add it before b38!

Only suggestion now is to display the keyboard shortcuts the first time you open the console (every game the 1st time).

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Further DebugConsole improvements

#11 Post by yufra »

Canderel wrote: Only suggestion now is to display the keyboard shortcuts the first time you open the console (every game the 1st time).
Great suggestion, I added a header to the latest commit. I am not going to touch this again to give you guys some time to test it and give feedback. I let DG know this is in the works so I think it will make it into b38 just fine.
<DarkGod> lets say it's intended

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Further DebugConsole improvements

#12 Post by yufra »

Alright, here is a detailed changelog of what I sent DG this morning:
Added a welcome message and keyboard shortcuts.
Added path string auto-completion.
Added a blinking cursor.
Added Ctrl+Space to show a function's help and Ctrl+Shift+Space to show a function's entire definition.
Added Ctrl+K/Ctrl+End to delete to the end of the line.
Added ordered multi-column display to both auto-completion and table display.
Added Page Up/Down scrolling of the history.
Added special cases for table and function auto-completion where a "." and "(" are added, respectively.
Fixed a few bugs.
DG suggested adding a real cursor rather than inserting a fake character, and pointed me towards `engine.ui.Textbox` for inspiration. I also want to look at adding a scrollbar at some point (DG suggested `engine.ui.Scrollbar`), but for now I think I will be taking a break from these changes. The changes have had limited testing and I have fixed all the bugs that I and tiger_eye found. If you find anything please let me know and I will fix them and probably release an addon fix as well. Thanks again to everyone that helped!
<DarkGod> lets say it's intended

Post Reply