One of our guiding principles in building Corona SDK was that the developer experience mattered. This means enabling you to do things as quickly and easily as possible. Simplicity is key – we want to take something complex and remove all the unnecessary elements, so you can focus on the work that matters.

Recently, we decided we wanted to extend that point of view to the actual coding experience. Now the community has already produced some fantastic mobile tools and IDEs, so instead, we looked at the more basic problem of editing code.

Corona Editor

Corona-Editor-SublimeToday, I’m happy to announce Corona Editor (Beta), our answer to the old problem of making code editing painless. It takes what we think is the world’s best text editor, Sublime Text, and provides first-class integration with Corona SDK.

Take a look at this video tour to see how Corona Editor is a natural fit with the Corona philosophy of keeping the tool lightweight, so you’re able to make good use of it immediately:

As you can see, initial features include code completion for all APIs and constants, the ability to bring up API docs directly from your code (public release or daily build docs), and hot keys to launch your app in the Corona Simulator from Sublime.

There are still bugs to be worked out as it’s still in Beta, but you can play with it today! Head over to Corona Editor for instructions on how to install Sublime Text and the Corona Editor package.

Open Source

github-logoWe are making Corona Editor completely open source, so send us your pull requests. Your contributions will help the entire Corona community!

In terms of future improvements, we’re looking at console integration directly in the Sublime editor and debugging support for breakpoints. Let us know if you’d like to help!

One of the things we hope this plugin will do is improve code editing in other text editors and IDEs. The Corona Editor project comes with a raw list of Corona APIs. They’re generated straight from our docs to enable code completions in Corona Editor. We will automatically be updating this file to reflect changes in daily builds, so this should be especially handy for enabling completions in other text editors and IDEs.

Special thanks to Christopher Spence for his invaluable insights and feedback during development.

  1. console integration is easy on mac. Just make a new build system looking like this:
    {“cmd”: [“/Applications/DailyBuilds/CoronaSDK.1202/Corona Terminal”, “main.lua”]}
    (with your own corona path off course). Now corona terminal will run in the build results console.

    You can put a shortcut on “show build results” in the User Keybindings like this
    { “keys”: [“super+$”], “command”: “show_panel”, “args”: {“panel”: “output.exec”} }

  2. 64bit windows users will have to amend the path to the Corona Simulator executable. If you’re already a daily ST2/3 user, this is second nature. If not:

    Preferences menu->Browse Packages
    Open the Corona Editor folder and drag ‘Corona SDK.sublime-build’ into sublime for editing. Change line #6 to add (x86) as such:
    “cmd”: [“C:\\Program Files (x86)\\Corona Labs\\Corona SDK\\Corona Simulator.exe”, “$file_path\\main.lua”],

    and you’re done.

    • Which version of Sublime are you using? I have the same issue with Sublime Text 3, which seems to down to the plugin looking in the wrong directory for completions file.

      I’ve tried fixing it myself, but for some reason playing with the sublime-package file seems to create new, seemingly unrelated problems. Anyone have any idea what might be causing that?

  3. I’ve been a user of Coda for a while, but when working with Corona, the options have been pretty limited. I’m excited to try out an IDE that is specifically geared toward Corona integration. That said, should I download Sublime 2 or 3?

    • I tried to create my own build with :

      {
      “selector”: “source.lua”,

      “windows”:
      {
      “cmd”: [“C:\\Program Files(x86)\\Corona Labs\\Corona SDK\\Corona Simulator.exe”, “$file_path\\main.lua”],
      “file_regex”: “(^[C-Z]:[^:]*):([0-9]+):([0-9]*)(.*)”
      },

      “osx”:
      {
      “cmd”: [“open”, “-a”, “/Applications/CoronaSDK/Corona Simulator.app”, “$file_path/main.lua”],
      “file_regex”: “(^/[^:]*):([0-9]+):([0-9]*)(.*)”
      }
      }

      Still getting the same error…

      • No… Mine was installed using Package Control. Perhaps this is something simple like windows hiding ‘system’ files? Maybe hidden file extensions is letting you create this file? Unclear. At any rate, the build file you have above won’t work because you need a space between Files and (X86). You can try changing that and see if you do better. Wacky situation.

        Try adding the space..?

  4. I would like to say that I think it is a wise decision by Corona Labs
    to do a package for Sublime instead of wasting energy on creating an IDE of
    their own. Sublime text is superb… feels so good in your hands and eyes.

  5. I don’t recommend changing the build file shipped with the plugin. It will just get overridden next update. I suggest making a copy in your user folder when using browse packages. Then selecting this build system in the menu. It will persist between updates.

    Unfortunately the build system file is not 100% compatible with all windows machines. Future updates hopefully with have user config file so you can set your own path and the build file will be dynamic.

    I would recommend st3 for new users. It’s nearing release and most plugin developers are focusing their effort on st3 and not st2.

  6. One thing I would like to see fixed (and I presume you are already working on) is that as soon as you press “.” the autocomplete disappears.
    This means that while I’m typing “display” I get ALL of the display functions and properties. If I want to narrow that down to just the ones that begin with “display.new” however, the autocomplete disappears and I have to type it in myself which makes it far less useful. If I want to use newRoundedRect, I have to press down over 30 times (you can’t press the up arrow or you move the cursor up to the next line), or switch to the mouse (and no one wants that).

    Other than that, good stuff!

  7. Also how do I get to read console output in Sublime? Hitting build from Sublime seems to work but it should also launch a console window too right?

  8. Ah ha. Figured it out. If you type ‘display.newIm ‘ it’ll give you the auto complete choices but with no parameters. The secret is not to type the ‘.’ and THEN choose the function you want and THEN hit TAB, and it’ll auto complete with the parameters.

    Hmmmm, might have to give Sublime another go. It’s been years. :)

  9. Anyone else having problems getting the plugin to show up in Sublime text / view / syntax?

    I’ve installed via the instructions here: https://sublime.wbond.net/installation#Manual

    Tried both manual and console installs on both Sublime 2 and 3 and nothing showing.

    I’m on OSX 10.8.5

    The plugin shows up in the “Installed Packages” folder.

    Any idea what I’m doing wrong please? Would really like to get this working ‘cos it looks brilliant.

  10. Question: In sublime if I double click on a object, like “doorObject.alpha”, in textWrangler, it would just select “doorObject”, but now in sublime it selects “doorObject.alpha”, which isn’t what I want. I tend to copy big sections of code to reuse, and need to quickly relabel all the objects in that section of code, so I need to be able to quickly select just the object name, and not the whole thing including the period and setting. I’ve been searching for how to change this default, but can’t find it.

    • The relevant preference is documented in the README.md:

      * **corona_sdk_complete_periods** (default: True)

      Corona Editor turns off the special meaning of periods as “word separators” in Sublime Text to make Corona completions work better. If you like to use cursor movement keys like “Alt+Arrow” to move to the periods in function calls you might want to turn this off. The most obvious effect of turning it off is that when you type a period all the completions disappear until you type another character.

      Just set that in your Sublime Text user preferences file (you can open it using [B]Preferences > Settings – User[/B] like so:

      “corona_sdk_complete_periods”: false

      More info on Sublime Text preferences here: http://www.sublimetext.com/docs/2/settings.html

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>