Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: Adriweb on October 18, 2012, 04:58:12 pm

Title: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Adriweb on October 18, 2012, 04:58:12 pm
the tinspire group (https://groups.google.com/d/msg/tinspire/JhFCHNtTrNg/2HWlBwTlcnkJ) as a Lua IDE (thanks to its wonderful Lua plugin), and I believe it can be quite good for you guys, especially for big projects where the current SDK isn't efficient (no support of multiple files etc.).

Here's some details on how to setup what you can see at the bottom of this post ;)

Basically, you can do either :
This (longer but it will make seperate SDKs for normal computer Lua and Nspire Lua)
or (easier/faster but it will make computer lua think it has nspire lua API available) :
After all that, create a new Lua project, and in the libraries on the left side, you should see not only the stdlib (of which you can unlink the io and debug API which aren't present on the Nspire), and you should be able to enjoy Intellij's Lua plugin things but for the Nspire Lua API too.
This it what it looks like when it's set up, on my computer :

Autocompletion example (of the events and other functions ) :

(http://i.imgur.com/Zh1eJ.png) (http://i.imgur.com/Zh1eJ.png)

(http://i.imgur.com/5yr6N.png) (http://i.imgur.com/5yr6N.png)


Auto-completion + arguments help :

(http://i.imgur.com/aFzak.png) (http://i.imgur.com/aFzak.png)


Interactive documentation based onInspired-Lua's wiki (http://wiki.inspired-lua.org) :  (Ctrl-Q on a word)

(http://i.imgur.com/kFLhB.png) (http://i.imgur.com/kFLhB.png)


Nspire-Lua API plugin : download here (http://tiplanet.org/forum/archives_voir.php?id=8182) (http://tiplanet.org/forum/archives_voir.php?id=8182)


Good luck and have fun :)[/list][/list]
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: ElementCoder on October 19, 2012, 04:04:03 am
Wow this is awesome! Can it run the programs too or do you still need the TINCS/Handheld to test? (I guess the latter :P)
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Adriweb on October 19, 2012, 07:30:10 am
Wow this is awesome!
Thanks :)

Can it run the programs too or do you still need the TINCS/Handheld to test? (I guess the latter :P)
Indeed this is just for editing.

But then you have for example Luna, which you can use in a shell script to build your files and open the .tns in the software etc, all that called from within the IDE with a build configuration.

We use that for FormulaPro : https://github.com/adriweb/EEPro-for-Nspire/blob/master/build.sh

Edit : however, if you want to test out some algorithms for example, written in "pure" lua, it will run indeed in the console :) (for that you have to install Lua for your computer tho)
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Jim Bauwens on October 19, 2012, 10:45:05 am
Note that FormulaPro will eventually use the new build system I made :)

Nice work Adriweb !
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Adriweb on October 19, 2012, 12:06:55 pm
Thanks :)
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: trmpereira on May 24, 2013, 06:10:37 pm
Is it possible to do this with the

Making the words that are commands to be colored in text program like etexteditor copy for windows of textmate (mac)
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: ElementCoder on May 30, 2013, 03:01:08 pm
I'm not sure what you mean, but if you mean syntax highlighting then yes it does that.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: kyllopardiun on June 15, 2013, 03:09:58 am
Just a little tip for folks on windows and with more than one file to compile in luna:



Quote from: compile.bat
type 1.lua 2.lua 3.lua > output.lua
luna.exe output.lua output.tns
del output.lua

PS: in most cases (at least for me) is better to specify manually files in order to be compiled than trying type *.lua >output.lua
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Jonius7 on June 29, 2013, 06:53:56 am
I can't believe I haven't seen this before. This will really help me try and get back into Lua programming.
Now only thing is more convenient .lua -> tns conversion and loading into emulator, which there might be some tools lurking around that I haven't discovered, or forgotten, or not know how to use.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: imath on June 30, 2013, 12:39:23 am
Pretty good.
I wanna write a visual IDE later based on XML and SM
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: ExtendeD on June 30, 2013, 04:47:16 am
To load the file into the emulator, maybe some AutoIt hack would as I did for the NdlessEditor.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Adriweb on June 30, 2013, 05:26:49 am
Hmm, seeing activity on this topic reeminded me that I had a 2.1 version of the plugin that I just uploaded : http://tiplanet.org/forum/archives_voir.php?id=8182
No major things but improvements here and there.

Also, depending on IDEA's version (apparently), some autocompletions get better, some "worse" (not so bad but...), meh, it's still very helpful :)


BTW, I have set up in the IDE a special "tool" that makes me able to directly launch TINCS with the script (it saves the .lua file, calls Luna on it, and launches it.)
It's a simple one-liner, and can trivially be ported to a Mac command. As for Linux (and actually nspire_emu, it would require a bit more work, yes...)
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Jonius7 on July 03, 2013, 02:53:01 am
How do you get the interactive documentation and arguments help configured properly? I haven't got them working, I've got the autocompleting menus popping up fine but I'm not sure if I've stuffed up config of libraries at some point (putting into Kahlua)
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Adriweb on July 03, 2013, 09:19:47 am
I haven't figured out a way to get args hemp 100% of the time.
It' pretty much because things that are passed by the functions aren't really recognized as external elements (gc for example) that it can look up for help.
Try not passing (temporarily, while you write) gc as an argument, for example, and start typing 'gc:drawS' for example. Sometimes with "gc." I'm not sure.
The Lua addon is great but not so wonderful with external APIs that have objects stuff like this...

Anyway, my setup instructions is nothing more than what I've written in the first post of this topic
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: imath on July 06, 2013, 03:42:41 am
hello adriweb,
maybe we can write a Visual Lua based on C#,GDI+,XML and Screen Manager.
how do you think of it?
I think it would be a vase but profound project.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Jonius7 on July 06, 2013, 06:37:44 am
Where are the module settings? I could only find plugin settings where I could install plugin including Lua from repositories.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: The_King on December 07, 2013, 10:58:46 pm
can have detailed tutorial for this

i am stuck the part with no sdk

i downloaded intellij idea yesterday

thanks in advance

hking1
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Jonius7 on December 31, 2013, 12:17:21 am
For now I'm still using the combination of Notepad++/luna/kArmTI to code and test my Lua code.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Jonius7 on September 03, 2014, 07:59:06 am
I tried this again, a year later with IntelliJ 13.1.4 and the process seems to be even more convoluted than before. IntelliJ itself has seemed to turn more Eclipse like focusing on Java and stuff.

I had to restart after installing the Lua plugin. Then after adding the nspireLua API library. It wouldn't detect auto-complete when I tried to type "function on." However it seemed to work for "timer", and other single words.
Fetching documentation (Ctrl+Q) does not retrieve from inspired-lua wiki (Unless the wiki page has no info?)

I tried messing around with module and plugin settings but I don't know what I am doing, even after now I have some experience with IDEs such as Eclipse.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Adriweb on September 03, 2014, 04:23:37 pm
I tried this again, a year later with IntelliJ 13.1.4 and the process seems to be even more convoluted than before. IntelliJ itself has seemed to turn more Eclipse like focusing on Java and stuff.
Well, Intellij IDEA is a Java IDE. But supports some plugins making it capable of handling other languages.

I had to restart after installing the Lua plugin.
Yes, after each plugin install, you have to restart the IDE.

Then after adding the nspireLua API library. It wouldn't detect auto-complete when I tried to type "function on." However it seemed to work for "timer", and other single words.
Hum, that works for me :
(http://i.imgur.com/LJvLJ3E.png)

What doesn't really work is gc: autocompletion (or any class instance I believe).
In fact, for gc autocompletion, it works if you don't put "gc" as parameter in the function you're in, while you're coding it (when you're done, obviously put it back) :
(http://i.imgur.com/Q7f2CpG.png)

Fetching documentation (Ctrl+Q) does not retrieve from inspired-lua wiki (Unless the wiki page has no info?)
That used to work... I'll take a look at what changed/broke.
Title: Re: Nspire-Lua IDE : plugin for Intellij IDEA
Post by: Jonius7 on September 03, 2014, 05:52:05 pm

Fetching documentation (Ctrl+Q) does not retrieve from inspired-lua wiki (Unless the wiki page has no info?)
That used to work... I'll take a look at what changed/broke.

Ah I just realised. It seems to fetch from internal documentation (within Kahlua/Lua or similar). There is a button (up arrow) called External documentation, that when I clicked it, led me to the corresponding wiki page.