Anyone Using Sublime Text 2?

I just looked at my mac, 

"cmd": ["/Applications/CoronaSDK/Corona Terminal", "main.lua"]

Does in fact work and it works much nicer than Windows as it is integrated rather than a separate shell.

As for working_dir, I am seeing issues with it on OSX, but seems to work fine with Windows.  Going to check to see if I can get a better way to make this work.

Yeah, I just tried using that line by itself…

Builds: yes

Builds from subfolder: no

Reloads sim or creates second instance?: second instance

Hopefully you have some ideas about this later. :slight_smile:

I got it working last night.  Sometimes I get a 2nd instance, but most of the time as soon as I save the file in ST2, the existing instance restarts for me.

One thing I noticed is that I have to have an active tab to the folder where my main.lua is.  If I’m on a tab that’s in a different directory it won’t start.

Also, Under Tools->Build System you have to select Corona.  I did this in one project and everything was fine, went to another project and it was set to something else, so it seems like it needs set on a project-by-project basis.

All of my projects run using ST2 project files (located in the root of their respective projects). main.lua is always open because I use it for keeping notes. And mine auto-selects CoronaSDK as the build system, I assume because I save main.lua first and make sure that’s set to Lua (CoronaSDK) as the language.

Just having the tab open for me doesn’t affect anything- you have to build (Cmd+B ) from a file in the root folder or you’ll get the error message. But as far as I can tell it can be any file from root (well, any lua file). But I’ve never, ever seen build restart an instance. The only time an instance restarts (in my experience) is if you save - the SDK detects changes and auto-reloads. 

If you add the “selector”: “source.lua” it will cause it to automatically use that build system for .lua files. Then you can just leave it on automatic.  Otherwise you have to select Corona.  If you pick it, it will save the build system chosen on a project by project basis.

Ah, always wondered what “selector” did.

Any luck with a better method, cspence?

Selector is similar to source in snippets.

Only problem is if you code lua for other things, it will use the same build for all, but you can get fancy and do alt-builds so you hit a control key when hitting control B and you get a menu which one you want to use.

Nothing new yet, I’m looking into it, but I think it may be a Corona thing, checking with Corona and Sublime, but Sublime is slower than slow for anything support and likely never to get a response.

Interestingly enough, I gave your code a try for the Windows build.

{

  “working_dir”: “${folder}/”,

  “cmd”: [“C:\Progra~2\Corona~1\Corona~1\corona~1.exe”, “main.lua”],

  “selector”: “source.lua”,

  “shell”: true

}

But…it just loads Corona and the shell window; there’s no errors but the game is not run by the simulator, either. Switching ~1 with ~2 at the end gives the error “C:\main.lua not found.” Not sure which one tries to load Corona.Debugger vs. Corona Simulator, though.

(Incidentally; Lots of .c errors from Corona if I attempt to run .CAF files via the windows simulator. Sim framerate goes from 30fps solid on OSX to 3 on W7)

I use ST2, but I’ve never taken the time to try and get CMD-B to work.  I just want that error message on startup to go away.

I use Sublime Text 2, its quite easy to get it to build with Corona. 

In ST2, go to Tools > Build System > New Build System and paste the following, then save:

{     "cmd": ["/Applications/CoronaSDK/Corona Terminal", "main.lua"] }

If you have not stored Corona SDK in your applications folder, you will need to amend it to the file path you saved it in. 

Rob - What error message are you talking about? 

EDIT:

Or, if you want to install this: https://github.com/drowne/Corona-Sublime which includes build system and auto-complete for many of the API’s, open Terminal and paste these two commands:

  1. cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages

2) git clone https://github.com/drowne/Corona-Sublime.git

“Error loading meta info: Expected key scope”.  Admittedly I’ve not looked in the past 6 months to see if there is a fix for this, but it has something to do with the Corona bits.  Though it seems people may have figured it out.  Let me see if I can make it work.  

BTW: The build system works wonderful, though I see two corona icons in my doc, dunno why?

EDIT: Fixed the stoopid scope error that’s been plauging me for a long time. 

cd ~/Library/Application Support/Sublime Text 2/Packages/Corona-SDK

vi Completions.tmPreferences   (or use the editor of your choice, perhaps Sublime 2?)

Add:
    <key>scope</key>
    <string>source.lua</string>

after:

    <key>name</key>
    <string>Completions</string>

Problem solved.

The only problem with the ST2 build system is that every time you build it opens a new corona window. I should really tweak it to close any existing simulators?

Maybe remove your corona bundles and reinstall from the github link i posted? (backup first of course) it sounds like one of the files it tries to load has some syntax error. 

Actually, that’s the first thing I tried. But it doesn’t work. At least in my case. And yes, corona is stored in the default location. I found a lot of examples online that setting up build system like you described doesn’t work for most people :frowning:

But it does for some. Why is that? I doubt anyone could answer this question :slight_smile:

Ok, just managed to get it to work. And by using this method it doesn’t launch new Corona Simulator every time you hit CMD+B. Here is the build system:

{ "cmd": ["/Applications/CoronaSDK/Corona Simulator.app/Contents/MacOS/Corona Simulator","$file\_path"], "selector": "source.lua" }

And managed to get tmbundle to work, craftydeano posted it above. But it’s rather old, so I doubt it has the newest API autocompletion?

c0ppo, just tried your method on my Mac (10.8.3) and it’s good news/bad news.

  1. It does work - previous solutions to this problem require copying over the “simulator” file from old Corona SDK installs that for some reason Corona Labs dropped from the build earlier this year.

  2. Despite what you said it clearly does not block launching new simulators. (I just tried it)

  3. The big problem with this method is that you *cannot* build anywhere except the root directory. Attempting to build from any other folder (maybe you have a “logic” subfolder in your project or something similar) will just result in an error message from the SDK, which basically means something about how ST2 is sending the path is faulty with that command line.

(To be fair, my method has the same problem. But I haven’t found a way to fix it.)

  1. As for bundles, I think I’m using something newer than the textmate version, but not by much (year+?) Tons of unsupported autocomplete functions in it, but better than nothing.
  1. In my case it does. Only one simulator launched, and when I click on CMD+B new simulator opens, and old closes down :S

  2. Haven’t really tried this. I just experimented by launching sample apps, and they all work normal. I’m gonna make a small app using subfolders and test it out and then report here.

  3. Same thing here. But it’s one year old. If I get some free time, I’m gonna try to update that bundle. It’s really a shame that probably that probably the most popular text editor doesn’t have a corona SDK package :frowning:

I would make my own and publish it, but my python skills are zero to none :slight_smile:

I use Sublime both on Windows & Mac w/ Corona SDK.  

The CoronaSublime plugin is useful, but not really needed as you can make your own build configuration pretty easily and it doesn’t have full code intel as many are missing.

It is slightly different dependent if you are on Windows or Mac.

The bundle does not use Python, it’s just a bunch of snippets and so on.

It’s very easy to edit and bring up to date, just time consuming.

What version of SublimeText2 are you using? Maybe it’s version specific. I’m not using Version 3 Beta yet.

The autocomplete stuff is a shame; if I could figure out the syntax I would update that. I’ll try to look closer. One flaw in the autocomplete system though is that it does not seem tolerant of pre-typing, that is, typing

“display.newI” will trigger the autocomplete for “display.newImage”, but when you accept it, it becomes “display.display.newImage” because it can’t handle the library prepack.

cspence: I can’t really agree on the build system. Last time I looked the documentation was little to none and there was nothing in it to suggest solutions to multi-client or subfolder pathing. :frowning:

I use ST2 and ST3 beta side by side.

I haven’t found anything about the pathing either, I just go to the a top tier file and hit control/command b.

I don’t think there currently is a way.