Corona Editor + Sublime Text

Corona Editor + Sublime Text

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.

walter
34 Comments
  • Jorge
    Posted at 15:15h, 14 October

    Awesome! I’ve been using Sublime + Corona as my main editing tool for a while, glad to see it’s becoming even more integrated.

  • Damir
    Posted at 16:04h, 14 October

    Is there a way to see all functions inside a lua file (and goto)?

  • ojnab
    Posted at 17:02h, 14 October

    @damir, on mac it’s cmd+r.

    • Damir
      Posted at 08:57h, 15 October

      The list is sorted as the function are ordered inside the lua file.

      Is there a way to get the list sorted alphabetically ?

  • ojnab
    Posted at 17:08h, 14 October

    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”} }

  • MOcean
    Posted at 18:48h, 14 October

    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.

  • Doug Davies
    Posted at 20:59h, 14 October

    When I do something like display.newCircle( ) I don’t see the parameters like the video shows. Ideas?

    • Tom
      Posted at 06:56h, 15 October

      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?

  • Peter
    Posted at 11:26h, 15 October

    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?

  • Francisco Lorca
    Posted at 12:34h, 15 October

    As a Sublime Text user, this is another thing to love Corona SDK even more. Thanks Walter!

  • Antheor
    Posted at 03:17h, 16 October

    MOcean I have indeed some problems with ctrl B on my windows 64.

    I can’t find corona editor folder, I only have a “Corona Editor.sublime-package” …

  • Antheor
    Posted at 04:11h, 16 October

    … I guess your tip works only if I do a manual installation (download).

    • Antheor
      Posted at 04:22h, 16 October

      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…

      • MOcean
        Posted at 10:41h, 16 October

        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..?

  • ojnab
    Posted at 05:18h, 16 October

    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.

  • brocoli
    Posted at 09:45h, 16 October

    Why is the syntax based off the native Sublime Lua syntax rather than the LuaSublime package one?

  • Antheor
    Posted at 11:28h, 16 October

    No way for me to see the folder….

    Anyway your correction on my custom build is working !

    Thank you !

  • Christopher Spence
    Posted at 14:03h, 16 October

    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.

  • Alex Poon
    Posted at 18:10h, 16 October

    Neat, but I’d love to get something similar as an Eclipse plugin!

  • Alan
    Posted at 02:18h, 17 October

    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!

    • Christopher Spence
      Posted at 17:53h, 17 October

      This is being worked on, but you can select your choice before finishing typing.
      I’m trying to get Fuzzy enabled again as that is how it was initially designed, this would make it even easier.

  • Indianapolis Mobile App Development
    Posted at 12:03h, 17 October

    Looking forward to this. Two of my favorite development tools!

  • Craig
    Posted at 13:58h, 17 October

    Awesome! you made a wise choice here. I’m not changing to any other text editor after falling in love with Sublime.

  • Mario Roberti
    Posted at 18:37h, 17 October

    Hey I’m with Doug! Why aren’t all the parameters showing up when I hit auto complete? Windows 64bit Sublime 2.

    🙁 Without those I’m lost….

    -Mario

  • Craig
    Posted at 20:07h, 17 October

    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?

  • Mario Roberti
    Posted at 21:21h, 17 October

    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. 🙂

  • Piotr
    Posted at 05:29h, 18 October

    After comment “–” you can’t tab, beacuse it will automcompete words.
    Is there way around this?

  • Claude Turcot
    Posted at 12:16h, 18 October

    Maybe a stupid question but how can I start Corona Simulator to test my application from within Sublime?

  • Vic
    Posted at 19:20h, 19 October

    Great work! Keep up growing, you deserve it because you have an awesome tool 🙂

  • Dougi
    Posted at 00:31h, 20 October

    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.

  • Antheor
    Posted at 07:57h, 10 November

    Claude, I’m sure you found it now : cmd+B

    BTW, is there any way for cmd+B NOT to open each time a new simulator ?

    Thx

    • Perry
      Posted at 15:50h, 13 December

      You need to be running the latest Corona Simulator.

  • Tyler
    Posted at 15:21h, 13 December

    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.

    • Perry
      Posted at 15:49h, 13 December

      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