My Work On a Lua IDE

I have been working on a Lua IDE within the FREE IntelliJ IDE.

Screenshots, Screencasts, and setup instructions on the wiki page:

http://bitbucket.org/sylvanaar2/lua-for-idea/wiki/Home

Here's an (incomplete) feature list:

Modules support
Debugger support (Experimental)
LuaDoc Support (Experimental)
Lua SDK REPL Console (Experimental)
Live Templates ("Zen Lua")
Basic Completions
Quick Documentation with Multiple documentation providers
Resolving Globals in project and libraries
Custom API Support including custom function signatures (Experimental)
Function Information via Quickhelp
Lua Standard Library Information via Quickhelp (ctrl-Q)
Hilighting of Upvalues and Fields
Goto Symbol
Safe Delete (Experimental)
Rename Identifier (Experimental)
JavaHelp For Lua 5.1
Execution in the Kahlua interpreter
Go to definition
find usages
Code formatting
Keyword completion
1 quickfix
5 code intentions
6 code inspection
Highlighting global vs local variables
Script execution and run configurations
Kahlua interpreter window for interactive script execution (repl)
Comes with an embedded Lua compiler written in Java (Kahlua)
Structure view
Syntax checking
Syntax highlighting - including proper handling of extended syntax comments and quotes
Customizable highlighting colors
Code folding for code blocks and comments
Brace Matching for do blocks, long strings and comments, and (, { , [
Minor feature: comment in/out.

To install the Lua plugin, use the plugin manager inside IntelliJ

To do so, choose File/Settings/Plugins, and Locate the Lua plugin and right click it and choose install.

I have been using your plugin, all I can say is:WOW, the new update has really helped speed up my development time.

Is it possible to do function parameter autocomplete?

Glad you like it. I have been developing it for almost a year - so it is nice to hear that people are enjoying it.

Im not 100% sure what you mean by parameter autocomplete, but I am working an interface to allow custom API's (such as corona) to have auto-completion and documentation for their functions (sort of like the documentation you see when ctrl-hover over a std lua function like io.write, or table.insert.

The custom API support is already built into the plugin, and the interface to it will be included sometime between now and the 1.0 release (at the time i am writing this the current release is 0.9.51).

the function parameter is when after you autocomplete a function it shows you the parameters of the function ex: auto completing table.remove will show table.remove(table, index), screen cast: http://screencast.com/t/MH7e2H9w4sG

PS: I think changing the name of a variable is broken in the new release? It works great in previous versions.

I see. Ok, i'll do my best to add it in. if it is not too difficult, ill try to get it in 1.0

Yes variable name change was broken in 0.9.50, its on my list.

Your feature request ticket is here:

http://bitbucket.org/sylvanaar2/lua-for-idea/issue/17/add-function-parameter-hints-on

Your change is in the latest version

Great work! I'm really happy to have found this, I use IntelliJ IDEA in my day job, and really don't know what I'd do without it.

What do I need to do to enable autocomplete functionality on Corona SDK classes (e.g. display., physics., etc)?

Well, cagatay was nice enough to set up the corona API, but we haven't posted it yet. In the meantime:

You can check out this ticket: https://bitbucket.org/sylvanaar2/lua-for-idea/issue/24/corona-sdk-import-error

and then these instructions:

https://bitbucket.org/sylvanaar2/lua-for-idea/wiki/Setting_Up_Custom_API%27s

Great! I've set this up, looks good. The completions aren't as intelligent as those in TextMate. In the short term, I'll just edit the lua2.lua file to conform to my development patterns.

cheers!

the completions and quickdocs are done, and can be found here:

https://bitbucket.org/sylvanaar2/lua-for-idea/wiki/Corona%20API%20Support

@akhtar

Great work there. Thank you so much!

Question:

Is there any way, currently, to have Corona function arguments/parameters shown in the tooltips? I see that the .properties file for WOW API is richer than the corresponding one for Corona -is this because it is made just for autocompletion?

If yes, are you planning to enrich the file so that arguments inspection inside IDE is possible, just like te wow example? That would be awesome!

I see that the Corona online API docs are well structured, so we could grab the "Syntax" snippet for each API function with a lua script.

Thanks again for your time!

Magenta:

The files you need are on this page:

https://bitbucket.org/sylvanaar2/lua-for-idea/wiki/Corona%20API%20Support

The Corona properties file is fully completed, so you should have full parameter info just like in the wow example if you set it up.

Docs are moving to a lua based mechanism now, so that you can supply them with a lua script (that is how the wow docs are working currently and the corona ones will be soon enough)

Here is the current wow documentation file (its Lua based)

https://bitbucket.org/sylvanaar2/lua-for-idea/src/452197717dc7/test/plugin/api/wow-api.doclua

@akhtar

This is great!

I can now properly see full arguments listing.

However, some functions (which are included in .lua) are not included in the .properties file. With the lua based mechanism you described, are you planning to make the argument retrieval procedure fully automated so that the functions are constantly in sync with the online docs? That would give an excellent documentation solution for Corona users!

PS: I am starting to love IntelliJ ... especially with your documentation solution it is a very nice editor to work with! Bye bye TextMate...

Work great!!!
We decided to use this Editor in our studio.
Thank you very much.

Well done, akhtar.

I installed your plug-in and Corona's API but I still can't figure out how to debug and launch Corona simulator from IDEA. Can anyone provide me details how to set it up?

Thank you very much in advance.

Looks great, I'll give it a try as I've been looking for an IDE and haven't found one I'm happy with yet. Any plans to support the Corona debugger? This would be huge for me.

Dudes. This is a Lua IDE. Continue to run your debugger as you have been.

bsoisoi, are you saying an IDE shouldn't have a built in visual debugger? Seems like an obvious feature for an IDE nowadays.

As an embedded Lua user you would have no use for a generic Lua debugger. You would want the debugging features from the Corona SDK.

I am looking into how best to provide such features, but for now you do have existing tools that can be configured to work with the IDE.

Maybe when I get some time this weekend I can put together a screencast.

>> As an embedded Lua user you would have no use for a generic Lua debugger.

Agreed, my suggestion was to integrate with the Corona SDK debugger so we could debug apps in the IDE running on the Corona simulator. I'd love to learn more about what you mean by configuring existing tools.

Ideally what would be a great integration feature would include being able to set breakpoints in a source file in the IDE, step through code from the editor and provide views for the stack trace, local variables, and watch expressions.

I'll give the IDE a try and see how it works, from the screenshots looks really good!

akhtar, I got it working and the plug-in is very nice! It takes some getting used to since it's my first time with the editor but I like the features so far. However, I can't get the parameter auto-complete to work even after following the install guide. Any ideas?

I'll look into it. You might try "Invalidate Caches" from (I think) the file menu.

I am not sure that will fix your issue.

I'll look into it.

I have been spending so much time working on the editor, I have been relying on users to provide usage feedback.

I think this weekend I will write a Corona app myself just to make see what the main hurdles are, and how to set everything up.

Then I can make a "setup" screencast which may help. Once you have set it up once, it becomes quite easy to set up...but the first time is always confusing.

I'd be glad to provide some feedback as I learn it. The install process was a bit unfamiliar because I had to install Lua and it wasn't clear how to do that since I never needed to with Corona.

I think I found the bug, looks like it's trying to do autocomplete for parameters but gets an error. Sorry for the long message but I figure you'll find this stack trace helpful:

:1: '' expected near `)`: :1: '' expected near `)`
se.krka.kahlua.vm.KahluaException: :1: '' expected near `)`
at org.luaj.kahluafork.compiler.LexState.lexerror(LexState.java:270)
at org.luaj.kahluafork.compiler.LexState.syntaxerror(LexState.java:281)
at org.luaj.kahluafork.compiler.LexState.error_expected(LexState.java:675)
at org.luaj.kahluafork.compiler.LexState.check(LexState.java:688)
at org.luaj.kahluafork.compiler.LexState.compile(LexState.java:191)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:125)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:117)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadstring(LuaCompiler.java:129)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.runLua(KahluaPluginDocumentationProvider.java:244)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.runLuaQuickNavigateDocGenerator(KahluaPluginDocumentationProvider.java:217)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.getQuickNavigateInfo(KahluaPluginDocumentationProvider.java:115)
at com.intellij.lang.documentation.CompositeDocumentationProvider.getQuickNavigateInfo(CompositeDocumentationProvider.java:59)
at com.sylvanaar.idea.Lua.codeInsight.LuaParameterInfoHandler.showParameterInfo(LuaParameterInfoHandler.java:81)
at com.sylvanaar.idea.Lua.codeInsight.LuaParameterInfoHandler.showParameterInfo(LuaParameterInfoHandler.java:31)
at com.intellij.codeInsight.hint.ShowParameterInfoHandler.invoke(ShowParameterInfoHandler.java:94)
at com.intellij.codeInsight.AutoPopupController$4.run(AutoPopupController.java:145)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:229)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:332)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:678)
at java.awt.EventQueue.access$000(EventQueue.java:86)
at java.awt.EventQueue$1.run(EventQueue.java:639)
at java.awt.EventQueue$1.run(EventQueue.java:637)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:648)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:652)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:505)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:404)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

se.krka.kahlua.vm.KahluaException: :1: '' expected near `)`
at org.luaj.kahluafork.compiler.LexState.lexerror(LexState.java:270)
at org.luaj.kahluafork.compiler.LexState.syntaxerror(LexState.java:281)
at org.luaj.kahluafork.compiler.LexState.error_expected(LexState.java:675)
at org.luaj.kahluafork.compiler.LexState.check(LexState.java:688)
at org.luaj.kahluafork.compiler.LexState.compile(LexState.java:191)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:125)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:117)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadstring(LuaCompiler.java:129)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.runLua(KahluaPluginDocumentationProvider.java:244)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.runLuaQuickNavigateDocGenerator(KahluaPluginDocumentationProvider.java:217)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.getQuickNavigateInfo(KahluaPluginDocumentationProvider.java:115)
at com.intellij.lang.documentation.CompositeDocumentationProvider.getQuickNavigateInfo(CompositeDocumentationProvider.java:59)
at com.intellij.codeInsight.navigation.CtrlMouseHandler.generateInfo(CtrlMouseHandler.java:234)
at com.intellij.codeInsight.navigation.CtrlMouseHandler.access$1000(CtrlMouseHandler.java:81)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$InfoSingle.getInfo(CtrlMouseHandler.java:313)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider.showHint(CtrlMouseHandler.java:538)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider.access$1900(CtrlMouseHandler.java:432)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider$2.run(CtrlMouseHandler.java:516)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:678)
at java.awt.EventQueue.access$000(EventQueue.java:86)
at java.awt.EventQueue$1.run(EventQueue.java:639)
at java.awt.EventQueue$1.run(EventQueue.java:637)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:648)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:652)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:505)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:404)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

se.krka.kahlua.vm.KahluaException: :1: '' expected near `)`
at org.luaj.kahluafork.compiler.LexState.lexerror(LexState.java:270)
at org.luaj.kahluafork.compiler.LexState.syntaxerror(LexState.java:281)
at org.luaj.kahluafork.compiler.LexState.error_expected(LexState.java:675)
at org.luaj.kahluafork.compiler.LexState.check(LexState.java:688)
at org.luaj.kahluafork.compiler.LexState.compile(LexState.java:191)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:125)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadis(LuaCompiler.java:117)
at se.krka.kahlua.luaj.compiler.LuaCompiler.loadstring(LuaCompiler.java:129)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.runLua(KahluaPluginDocumentationProvider.java:244)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.runLuaQuickNavigateDocGenerator(KahluaPluginDocumentationProvider.java:217)
at com.sylvanaar.idea.Lua.lang.documentor.KahluaPluginDocumentationProvider.getQuickNavigateInfo(KahluaPluginDocumentationProvider.java:115)
at com.intellij.lang.documentation.CompositeDocumentationProvider.getQuickNavigateInfo(CompositeDocumentationProvider.java:59)
at com.intellij.codeInsight.navigation.CtrlMouseHandler.generateInfo(CtrlMouseHandler.java:234)
at com.intellij.codeInsight.navigation.CtrlMouseHandler.access$1000(CtrlMouseHandler.java:81)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$InfoSingle.getInfo(CtrlMouseHandler.java:313)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider.showHint(CtrlMouseHandler.java:538)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider.access$1900(CtrlMouseHandler.java:432)
at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider$2.run(CtrlMouseHandler.java:516)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:678)
at java.awt.EventQueue.access$000(EventQueue.java:86)
at java.awt.EventQueue$1.run(EventQueue.java:639)
at java.awt.EventQueue$1.run(EventQueue.java:637)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:648)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:652)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:505)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:404)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

It is an obvious feature. However, the Corona SDK runtime is proprietary, so I'm doubtful that it'll ever happen without direct involvement from Corona.

Just an update, I got the latest version and the issue above has been fixed. I'm starting to use this as my primary editor now and will post feedback here as I go. One thing I'd like to see improved is the way parameters are displayed. It would be nice if it highlights the hint for each parameter as you type one without removing the tooltip in case there are many parameters. I think Eclipse and other IDE's do it this way so it's what I'm used to.

Thanks akhtar, as an IntelliJ fan I found this plugin through the normal plugin installer. It has been working great!

Hey akhtar, I've been using this as my main editor for Lua/Corona and it's been working great with the plugin. I have run into a few bugs that I'd like to report. Is there a place to do so, I could post here but don't want to clutter up this thread if there's a better place. Please keep developing this, it has alot of potential.

I just found this. Akhtar, I love you.

akhtar, just an update on using the IDE for a bit longer. It's my primary editor now with your plug-ins and I love it! I'll be creating some enhancement requests on your site but this tool has already saved me a ton of time and pain compared to what I was using before. I also shared it with my friend and he's already a fan after using it for a day. Please keep updating it and adding to it as it's a great help.

Neat! :)

Where is the lua sdk stored on a mac? this looks really useful!

You have to download it yourself from the bitbucket page here:

https://bitbucket.org/sylvanaar2/idlua-sdk-corona/wiki/Home

Hi, how are you? this seems to be a really interesting project, is it still under active development?

Cheers,
Nahuel.

Yes. It is.

I am re-evaluating how I want to continue. I am interested in trying to attract some more developers to the project going forward, but I would describe my development pace over the past 18 months as being quite active. I think feature-wise this is one of the best options out there. I think on average a new version has been released every 1-2 weeks sometimes more.

The only real issue I think this project has is that it takes a little effort to set things up the first time - after you do it once though - it becomes really trivial. This does have a an upside as my users tend to not need a lot of hand holding - but I would like to broaden the appeal of the tool in any case. People still even use LuaEclipse - and it hasn't really been updated in years. I need to figure out how to improve that situation.

Personally, I do all my Lua editing this way now - it is just so much better having features like auto-complete, syntax checking, code formatting, and semantic awareness. Not to mention that the IDE itself provides a full set of tools for development in general and is cross platform.

Hi I'm stuck on installing this...

I setup a new project in thwe wizard, when I get to "specify the Lua binaries directory" it already is populated with kaluha (unlike the screencast) if I add a new one I cannot find the Lua SDK despite downloading every zip I can find on the bitbucket page (really confusing lots of zips all over the place unsure which ones I need)

Can somebody please let me know which zips I need from the bitbucket page, and where to find the Lua 5.1.4 SDK?

Thanks!

It is where you install Lua. You would need to download Lua itself.

BUT you don't have to, you can choose kahlua if you want and set it up as your sdk. Using a native Lua interpreter isn't crucial for you as a corona developer since you won't actually be running your code via IntelliJ.

Hi akhtar,

appreciate your reply...

Ok so I've installed sylvanaar2-idlua-sdk-corona and its now listed in external libraries for my empty template, if I click on the corona_api.lua file within the external library group I can see the corona sdk commands...

So I make a file called main.lua in my project group, it shows the standard lua tips but none for corona, the screencast doesn't mention any other steps, but I'm obviously missing something...

So you did this?

https://bitbucket.org/sylvanaar2/lua-for-idea/wiki/Installing_a_Custom_API

If you did - it should work. You can try File|Invalidate Caches to see if that helps.

I just tried it myself to verify that it was working. I typed "disp" and got all the completions for display.whatever

yep done that and the external library is listed.

I can get the first part of the code completion to work, ie i type:

"di"

code completion pops up with "display" (the only thing listed)

there are no options for display.newGroup() etc

Ok I invalidated the caches as you suggested and it now fully completes.

Thanks for your help this really useful!

oop one last thing like magenda I can't get the function arguments/parameters to show in the tooltips

for instance the tooltip for display.newRect()

shows [Corona API] display.newRect()

It seems like the properties file in the zip file you pointed me to has the arguments in, so I don't think I need to download the files that you pointed magenda to...

************** edit ******************

Ok I've just spotted that not all of the properties are listed for every command, so the ones that are included are working correctly.

Thanks again!

Any tips on how to set this up on a Mac? Do I need to do a separate Lua install? I am trying to find my Lua SKD, but I dont see it, I thought maybe it came with Corona?

It doesn't come with Corona, I ended up downloading the Lua SDK myself and putting it my Documents directory. You may not need to do that as it looks like the Mac already comes with Lua in /usr/local/bin but maybe I couldn't find it at the time.

You've done great work but I can't use it due to a limitation in the editor itself. Maybe I'm missing it. TextMate allows you to group individual files in "virtual directories" or groups. Not sure how else to explain it. Basically, I have groups called spritesheets, extern (e.g. director goes here), objects, enemies, powerups, config, etc... These aren't actually directories on the filesystem though which is nice since all lua files need to be in the base folder. IntelliJ only allows you to group files in directories and these are actual directories on the file system. Is there a way to create file groups in the project file itself rather than directories?

Not that I am aware of.

That doesn't mean there isn't a way to accomplish what you want, I just don't know offhand how to do what you want.

views:2501 update:2011/10/5 8:48:05
corona forums © 2003-2011