Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Can Gideros API Auto-complete on ZeroBrane Studio? - Page 2 — Gideros Forum

Can Gideros API Auto-complete on ZeroBrane Studio?

2»

Comments

  • @paulclinger, I have not been able to verify all of the classes, but for those that test the inheritance worked correctly. Why colon after the symbol for the Bitmap class provides the function "new"?image
    And please add to the issuance of a global variable "stage".image

    Thanks!
    zb.jpg
    351 x 240 - 29K
    zb1.jpg
    330 x 186 - 16K
  • @sslivka, I'll check on "new"; also noted about "stage".

    @ianchia, thank you for the feedback. Can you elaborate on where you saw references to "Program Files"? There are couple of examples in cfg/user-sample.lua, but these are just that -- examples. I wouldn't expect to see anything else and make sure these are fixed. Also, what examples were not working?

    For the remote debugging, it should be as simple as adding "require('mobdebug').start('address or domain name of machine running ZBS')" to your script and setting the project directory for the source files to be found. I have more detailed instructions posted here (http://studio.zerobrane.com/doc-remote-debugging.html) and will be happy to answer questions if you can't get it to work.
  • @sslivka, I added "stage". The "new" function appears, because I can't (yet) hide functions when you type ":". It used to be that ZBS showed the same list for "." and ":", but then the API was extended to specifically mark "methods". Some of the descriptions are still using functions only (even for methods) and those would disappear if ":" lists only methods. I'll make the change when all the descriptions are updated; hope it's not too inconvenient.

    It may be possible to detect that *this* particular description is using "methods", so don't show functions after ":" for it, but it requires thorough testing; I'll see if I can introduce it in the next version...
  • ianchiaianchia Member
    edited June 2013
    Hello @paulclinger, I've downloaded the current ZBS (0.37) and tried again... still no joy.

    I've confirmed that my remote device build has luasocket compiled into it successfully with the following code:

    local socket = require("socket")
    local url = require ("socket.url");
    local unescaped_text = "/#?;askfk:kjskdf+kjasdf"
    local escaped_text = url.escape(unescaped_text)

    print ("unescaped text: "..unescaped_text,"\nescaped text: ",escaped_text);

    All works as expected.

    I followed your instructions at: http://studio.zerobrane.com/doc-remote-debugging.html and here are various results:

    >>> Open ZeroBrane Studio. Go to Project | Start Debugger Server and start the debugger server (if this menu item is disabled, the server is already started). <<<


    Yup. The server starts. It stays running. My development box's IP is 192.168.1.11 and the domain is prudence.local ... I can even start a terminal session with:

    telnet prudence.local 8172

    or

    telnet 192.168.1.11 8172

    and the terminal echoes the following:

    Connected to prudence.local.
    Escape character is '^]'.
    BASEDIR /Volumes/Willow/__projects_local/gideros_unit_tests... (etc, etc...)

    The output window within ZBS also outputs a bunch of errors complaining about my telnet connection, with lines like:

    >>>
    Can't debug the script in the active editor window. Compilation error:
    Debugger error: unexpected response after EXEC/LOAD ''
    Debugging session completed (traced 0 instructions).
    <<<


    Within telnet, I can issue a CTRL-] and close the socket connection via telnet. So I assume the Debugging Server aspect is working fine.

    >>> Open the Lua file you want to debug. <<<


    I assume that means I need to open main.lua as well as the class file (in this case, a file called marquee.lua).

    >>> Select the project directory by going to Project | Project Directory | Choose... or using Project | Project Directory | Set From Current File. <<<


    Yes. I did this both ways. I can confirm that ZBS is confirming the correct project directory by echoing it back in the telnet test results as per above.

    >>> Add require('mobdebug').start() call to your file. If the application is running on a different computer, you need to specify an address of the computer where ZeroBrane Studio is running as the first parameter to the start() call: require('mobdebug').start("12.345.67.89") or require('mobdebug').start("domain.name"). You can see the domain name to connect to in the Output window when you start debugger server: Debugger server started at :8172 <<<


    I did this at the top of my main.lua file as one experiment. This is my line:

    require("mobdebug").start('prudence.local:8172')

    I also tried:

    require("mobdebug").start('192.168.1.11:8172')

    I also tried the lines without the port number.

    I also tried putting it below the local socket = require("socket") as another experiment. No difference in results (see further below).

    For extra thoroughness, I also opened the TCP & UDP port for 8172 on my router's firewall.

    **QUESTION: I'm assuming that when you say: "Add require('mobdebug').start() call to your file", you mean that it just needs to be included once in main.lua for a Gideros project? Or do I put it into my marquee.lua class file? Where? In the :init() method? Surely it's not necessary to insert that into *every* file I want to debug remotely?

    >>>
    Make mobdebug.lua and luasocket available to your application. This can be done in one of three ways: (1) Set LUA_PATH and LUA_CPATH before starting your application (see Setup environment for debugging); (2) Reference path to mobdebug.lua and luasocket using package.path and package.cpath (see Configure path for debugging); or (3) Include mobdebug.lua with your application by copying it from lualibs/mobdebug/mobdebug.lua (this assumes your application already provides luasocket support).
    <<<


    I went with option 3.

    When I didn't have any luck getting it to work, I also tried putting this into the top of my main.lua above the require("mob debug").start('192.168.1.11:8172');

    package.path = package.path .. ";/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/mobdebug/?.lua"
    package.cpath = package.cpath .. ";/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/?.?"

    (not sure if my package.cpath syntax is correct for OS 10.8)

    Still no joy.

    Your last step is:

    >>>
    Run your application. You should see a green arrow next to the start() call in ZeroBrane Studio and should be able to step through the code.
    <<<


    What I see in the Output window is this:

    >>>
    Can't find the specified gideros executable '/Volumes/Prudence_HD/Applications/Gideros Studio/Gideros Player.app'.
    <<<


    It's weird because the .app file is definitely there. I can confirm that by going there in the terminal.

    But I don't want the local player. I want to debug remotely.

    I appreciate your continued help in getting this thing up and running... (-;

    (I'll go through the studio again and see if I can repro the examples not working and the Windows references etc.)

    Best,

    - Ian




  • ianchiaianchia Member
    edited June 2013
    Interesting - another datapoint. I remember that I had configured a ~/.zbstudio/user.lua file a few months back when I was trying to get it working.

    So I moved that out of the way and now I get different results:

    Output window says:

    Output (running)

    Program starting as '"/Applications/Gideros Studio/Gideros Player.app/Contents/MacOS/Gideros Player"'.
    Program 'Gideros Player' started in '/Volumes/Willow/__projects_local/gideros_unit_tests/Bowerhaus/BhHotWax_projects/cornerstonesolutions/photoSentinel_iPad_hotwax' (pid: 21932).
    Starting the player and waiting for the bridge to connect at '/Applications/Gideros Studio/Gideros Studio.app/Contents/Tools/gdrbridge'.
    Starting project file '/Volumes/Willow/__projects_local/gideros_unit_tests/Bowerhaus/BhHotWax_projects/cornerstonesolutions/photoSentinel_iPad_hotwax/_photoSentinel_ipad.gproj'.

    and I get an Error Dialog window popping up complaining about the wax module not being found on the server machine:

    init.lua:6: module 'wax' not found:
    no field package.preload['wax']
    no file 'lualibs/wax.lua'
    no file 'lualibs/wax/wax.lua'
    no file 'lualibs/wax/init.lua'
    no file 'lualibs/wax/wax/wax.lua'
    no file 'lualibs/wax/wax/init.lua'
    no file './wax.lua'
    no file '/usr/local/share/lua/5.1/wax.lua'
    no file '/usr/local/share/lua/5.1/wax/init.lua'
    no file '/usr/local/lib/lua/5.1/wax.lua'
    no file '/usr/local/lib/lua/5.1/wax/init.lua'
    no file './wax.lua'
    no file './wax/init.lua'
    no file './lua/wax.lua'
    no file './lua/wax/init.lua'
    no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/wax/wax.lua'
    no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/wax.lua'
    no file 'bin/libwax.dylib'
    no file 'bin/clibs/wax.dylib'
    no file './wax.so'
    no file '/usr/local/lib/lua/5.1/wax.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/libwax.dylib'
    no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/wax.dylib'
    stack traceback:

    Let me create a build that *doesn't* use @bowerandy 's hotwax module ...

    - Ian
  • Hello again @paulclinger

    I tried with this very simple unit test:
    -- ut.zbs
     
    -- confirm luasocket is in device binary
    local socket = require("socket")
    local url = require ("socket.url");
    local unescaped_text = "/#?;askfk:kjskdf+kjasdf"
    local escaped_text = url.escape(unescaped_text)
    print ("unescaped text: "..unescaped_text,"\nescaped text: ",escaped_text);
     
    require("mobdebug").start('prudence.local')
     
    require "ui"
    setStatusBarHidden(false);
    and ZBS indeed shows a green arrow at:
    require "ui"
    However, if I click the green arrow to proceed, ZBS then throws up the error dialog with:
    main.lua:12: module 'ui' not found:
    	no field package.preload['ui']
    	no file 'lualibs/ui.lua'
    	no file 'lualibs/ui/ui.lua'
    	no file 'lualibs/ui/init.lua'
    	no file 'lualibs/ui/ui/ui.lua'
    	no file 'lualibs/ui/ui/init.lua'
    	no file './ui.lua'
    	no file '/usr/local/share/lua/5.1/ui.lua'
    	no file '/usr/local/share/lua/5.1/ui/init.lua'
    	no file '/usr/local/lib/lua/5.1/ui.lua'
    	no file '/usr/local/lib/lua/5.1/ui/init.lua'
    	no file './ui.lua'
    	no file './ui/init.lua'
    	no file './lua/ui.lua'
    	no file './lua/ui/init.lua'
    	no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/ui/ui.lua'
    	no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/ui.lua'
    	no file 'bin/libui.dylib'
    	no file 'bin/clibs/ui.dylib'
    	no file './ui.so'
    	no file '/usr/local/lib/lua/5.1/ui.so'
    	no file '/usr/local/lib/lua/5.1/loadall.so'
    	no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/libui.dylib'
    	no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/ui.dylib'
    stack traceback:
    Do I have to build a OSX static library for every native Objective-C++ plugin I'm using my device build in order to use remote debugging? If so, I'm sad... The Mac doesn't have the same APIs or device capabilities as iOS, and hence I can't do that... I was especially looking forward to working on some Gideros plugins for iOS[redacted]. As it is now, it doesn't work using my current iOS6 native plugins.

    - Ian
  • Hi Ian (@ianchia),

    ZBS doesn't have any specific handling of Gideros library plugins and you should be able to use them without any issues (if it works in Gideros Simulator without ZBS). By looking at the stack trace, it seems that you are trying to run this script with "lua" interpreter rather than Gideros.

    Can you make sure that "Project | Lua Interpreter | Gideros" is selected? If it is selected, can you run the same script from ZBS, but comment out "require('mobdebug').start(....)" line? If you get your application running in Gideros simulator without that line, then it should work with the debugger as well.
  • ianchiaianchia Member
    edited June 2013
    Hi Paul (@paulclinger),

    It won't work. The Gideros simulator doesn't support any custom plugins, only the stock Gideros APIs. Gideros does support plugins for iOS & Android, but only on device builds. On iOS, I can also run the Xcode iOS Simulator and run my device build in that, and it'll work, but if ZBS relies on the Gideros Simulator (the Gideros Player.app) in order to do remote debugging, that it won't work as far as I know. @atilim ? @ar2rsawseen ? @bowerandy ? Any insights that you may be able to offer would be appreciated. (Or have I totally misinterpreted the fact that the Gideros Player.app doesn't support custom plugins?)

    (And the interpreter selection is definitely using the Gideros interpreter within ZBS.)

    Many thanks,

    - Ian
  • ar2rsawseenar2rsawseen Maintainer
    @ianchia not by itself no it does not support, but it is possible to set up the project to build it as Gideros player as a standard device player with the needed plugins :)

    Here is the description on how to build Gideros platform specific player with custom plugins:
    http://docs.giderosmobile.com/deployment.html
    Click on Device player with plugins
    ;)
  • Hi @ar2rsaween, thank you for your prompt response on the weekend! I already build my project as a device player with custom plugins. My app relies heavily on UIWebView and lots of integration between Lua and JavaScript and HTML5. What @paulclinger and I are bouncing around is whether the Gideros Player.app is required for on-device debugging within ZeroBraneStudio (I'm not sure why the desktop Gideros Player is necessary in this toolchain)? We are all agreed that "Gideros Simulator" == "Gideros Studio folder > Gideros Player.app" on Mac?

    I'm attempting to do on-device debugging while using a successfully compiled iOS Player "shim" player that connects via the network with either Gideros Studio or the gdrbridge. I can run the project successfully using either tool. What I *can't* do is to debug at runtime using ZBS - ZBS doesn't make a reliable connection. I have hacked at the code within ZBS on and off during the past few months, but haven't made a consolidated attempt or had any reliable success. :( I have got it to connect a couple of times, but haven't been able to work out the repro steps to actually get it to work while understanding *why* it worked... It's all up to a bit of voodoo or the phase of the moon at the moment. Not really how I want to approach a debugger (-;

    Best,

    - Ian
  • @ianchia, I started a new thread here: http://www.giderosmobile.com/forum/discussion/3430/on-device-debugging-with-zerobrane-studio as it's probably getting off-topic for this one...
  • @ar2rsawseen, thank you; didn't know about it. Does it mean you can add it there or is it a self-service? ;)
  • ar2rsawseenar2rsawseen Maintainer
    Yes I wanted to write a blog post explaining it, but there were already so many for this weeks, so most probably I'll write it next week, but yes it is a catalog managed by tool authors

    To add it, go to http://giderosmobile.com/ Log in Under your account menu (Hello, Yourname! ) Select Manage tools Add tool. There is a special category IDE created, just for ZBS ;)
  • Apollo14Apollo14 Member
    edited March 2018
    Guys, does autocompletion work for you in the latest releases of ZeroBrane Studio? I'm new to ZBS, installed v1.70, autocompletion doesn't work for some reason, what can it be?
    P. S. I don't see this stuff:

    @paulclinger
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • antixantix Member
    @Apollo14 autocomplete in ZBS only works for the builtin Gideros stuff, not your custom code AFAIK.

    Welcome BTW to the world of ZBS, it's a very cool program :)
  • antix said:

    @Apollo14 autocomplete in ZBS only works for the builtin Gideros stuff, not your custom code AFAIK.

    Welcome BTW to the world of ZBS, it's a very cool program :)

    @antix but on the screenshot they have auto-complete menu appeared while typing 'mySprite:'
    This is what I need so bad. :) How did they do it?
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • antixantix Member
    edited March 2018
    I see. It does not work for me either. Real men don't need AutoComplete FYI :D
    +1 -1 (+2 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    antix said:

    Real men don't need AutoComplete FYI :D

    Yeah, real men don’t even need an IDE, they enter bytecode with an hex editor... :smile:
    +1 -1 (+4 / -0 )Share on Facebook
  • Real men don't use a hex editor - they open up the hdd and use a magnet!

    Likes: antix, Apollo14, hgy29

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+3 / -0 )Share on Facebook
  • hey guys I've created a request, probably @paulclinger can help us :)
    https://github.com/pkulchenko/ZeroBraneStudio/issues/889
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • Wow!! Paul instantly added a patch for better Gideros support!

    I don't understand how to extract actual 'gideros.lua' file contents from his post without '+ '&'- '?
    (I'm new to Github and I'm extremely sleepy at the moment :s
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • antixantix Member
    He updated the github issue and made the entire file available for you.
Sign In or Register to comment.