From The Blog: Featured tool: Corona Plugin for Xcode

Any updates on this fix? Working on code with 8000 lines with numerous comments that don’t close with --]], only ]] makes 8000 lines of code one colour… Not too handy :(.     Close to bailing and going to Sublime, and I’d rather not.

PS: Search and replacing ]] for --]] was disastrous since there were multiple tables like [[I]] - which fell over miserably :slight_smile:

Hi Graham

Sorry I didn’t get to it yet… but here is a quick fix:

Run this command in the terminal:

sed -i -e 's/--]]/]]/g' /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/Corona.xclangspec

After running the command you need to restart Xcode.

Thanks.

Ahh… bliss… that’ll do for now :).  Thanks

When using block Editor/Structure/Toggle comments I’m getting // as comments instead of --. Any advice?

Another thing that I encountered is that Corona api lookup always invokes Safari instead of my default Chrome browser. Otherwise Xcode invokes default browser but not in the case of Corona api lookup.

I am afraid that it isn’t possible to change the toggle comment characters. I didn’t find a way to do it and I see that it doesn’t work for other Xcode supported languages like python, html, and applescript either… so I am pretty sure it is not possible.

Yes I changed it to always use Safari some time ago because of a bug in MacOS 10.12.5.

I think apple fixed the bug in 10.12.6 so if you are using that or later you can change it back like this:

Type in terminal:

open -a Xcode /Users/[your user]/Library/Developer/Xcode/UserData/Behaviors/doc-lookup.cfx.applescript

Now Xcode opens a script file. In that file locate this part:

tell application "Safari"     open location docUrl     activate end tell

and replace + save it with this:

open location docUrl

Now the docs should open in your default browser.

Thanks, Jacob

Thanks Jacob, your tip works great!

Here is a video demonstration of the Corona Debugger that will be part of the next release of the Corona Plugin for Xcode.

 

The debugger is being beta tested right now and will be released pretty soon!

Follow this thread to get notified about the update.

 

[media]https://www.youtube.com/watch?v=ct_PF_ijYko[/media]

How do I import an existing Corona project to Xcode? I tried the behaviour script “Import Corona Project” but it has no response.

I am using Xcode version 8.3.3

I believe a file browser/picker is supposed to popup but apparently not happening.  Kindly advise.

Finally managed to resolve the issue by adding a daily build to the Application folder.  My default Corona SDK has no -xxxx append to the file.  Seems like that cannot be recognised.

The auto completion is pretty bad compared to what I am getting from LuaGlider.  Somehow it is unable to recognise the tables that I defined within my codes.  Also after typing “.” after the class/library name, the entire list of Corona functions are displayed instead those specifically just for that class name.

E.g composer. will give the entire list of functions/constants that Corona has instead of just those specifically to composer.  :(

@Falcon777

There are a couple of simple prerequisites. Please read the guide before using the plugin. It is very short and explains everything: http://www.shakebrowser.net/corona-for-xcode/guide.html

The auto completion works like the one in Corona Editor not the one in Lua Glider. Auto completion for user defined tables are not supported.

Thanks for reporting. I see… this is a bug that needs to be fixed.

For now you can type either composer (without the dot) to get the full list of composer functions or or composer dot some letter(s) to get the composer function suggestions matching what you typed.

Regarding this issue:

This appears to be some bug introduced in late Xcode 8 versions. I tested with the Xcode 9 beta and Apple seems to have fixed it. So please wait for Xcode 9 or install the beta version.

The Corona Plugin for Xcode has been updated to v.1.5

 

The update contains: 

 

  1. A Corona Debugger.

  2. The Daily Build picker was updated to work with Corona-xxxx folders.

  3. Various minor improvements and fixes.

 

Get it here: https://marketplace.coronalabs.com/asset/corona-plugin-for-xcode

 

Please notice : this plugin will not update automatically like other plugins in the marketplace. You will have to manually download the update and install it over the previous version. To get notified about updates please follow this thread.

The Corona Plugin for Xcode has been updated to v.1.6   The update contains:    1. API completion/highlighting updated to Corona 2017.3154. 2. Migrated iOS templates to use Images.xcassets icon format. 3. Updated for Xcode 9. Get it here: https://marketplace.coronalabs.com/asset/corona-plugin-for-xcode   Please notice: this plugin will not update automatically like other plugins in the marketplace. You will have to manually download the update and install it over the previous version. To get notified about updates please follow this thread.

I noticed an issue around block comments. 

Per lua.org

A comment starts anywhere with a double hyphen (–) and runs until the end of the line. Lua also offers block comments, which start with --[[and run until the corresponding]].

The Xcode editor only seems to recognize the closure if there is a – in front of it (–]]) While I do it that way, a lot of people don’t, so while it runs fine, it all loses its colouring.

The screen shots attached show the same code, one in Sublime, one in Xcode.

Thought I’d mention it.

Thanks Graham

You are right. I will change it in the next plugin update.

I always use --]] though… because then it is very easy to toggle the comment on/off by adding/removing an extra double hyphen at the beginning of the block comment.

On the above, I use it too, but others don’t and its makes the code hard to read :slight_smile:

On this latest version I seem to come up with the same issue repeatedly. I import a new project, usually some code I find online I want to test, and I load it up, add the files and run it. All is good.

I then come back to it later, load up the project, and none of the files are there any more. It’s happened on multiple projects now.

Is it me?

I have just updated to High Sierra, and updated Xcode to Version 9.0 (9A235)

I did uninstall and reinstall the plug in (latest from marketplace)

Hi Graham

I am able to recreate the problem.

Something was changed in the way files are imported to a project in Xcode 9.

For some reason the files are added outside of the project now. I will fix it in the next update.

For now: after importing everything - if you simply drag the imported folder (or files) onto the project icon (in the file view) the files will be added to the project and will be there the next time you open it. 

Thanks, Jacob

FYI:

I recommend updating to Xcode 9.1 when using the Corona Plugin for Xcode.

Xcode 9.0 had a bug that - in some cases - forced annoying (swift style) indentation on lua code.

Apple has fixed that in v.9.1.

Remember to disable “Automatically indent based on syntax” under Xcode > Preferences > Text Editing > Indentation

if you see strange indentation behavior.