Lua autocomplete for Atom

Hi. Thank you for the suggestion. I do plan to do quite a few improvements to the plugin around July when I finish Uni. I’m in my final semester and things have been continuously crazy for the past months, so sorry if I was AWOL for quite some time. I’m still very much alive.

6 Likes

Thanks for your hard work.

I don’t know if you can benefit from this, but one of love2d atom extension has a very nice type aware autocompletion of the API.

2 Likes

That’s actually built upon my extension. I guess decoupling it from the Defold-specific stuff was a great idea :slight_smile:

6 Likes

Hi! So now that my life is moderately in order, I’d like to share some plans I have for this plugin. Going through the compilers course at Uni made me realise my approach for this was rather naive (and also, turns out trying to deal with efficiently snapshotting mutable custom data structures makes for some incredibly hard to maintain code). I’ve been meaning to start a rewrite for some time, but I’m glad I put it off because this gave me some time to think and research.

So, to do this by the book, I’m going to use lattices to model the Lua heap at different program points. After reading his paper and his code, I think going to use a similar approach as Jan Midtgaard’s LuaTA.

For this to work, I will need some good immutable data structures and I figured, sure, Immutable.js is cool and fine, but let’s take it one step further, so I decided I’d write the static analysis code in ReasonML and compile it to JS.

I played with Reason/OCaml these past weeks and managed to parse some Lua with a Menhir parser on the OCaml side, but compiled into JS, tail calls are not optimised and it overflows the stack on mid-sized Lua files. :frowning:

So, I figured I’d try to use some other parser and I stumbled upon Chevrotain, which seems to be fast and, most importantly, has error recovery, so it’s much better suited for in-editor use than the previous parser. So… yeah… I’ll write a Lua grammar… that will be fun! :smile:

This project made me research and learn a lot of stuff and I’m really happy about that. I’m still doing this in my spare time, though, between a part-time job and actually working on the game, so not making any release promises, but at least now the path to implementation is clearer.

10 Likes

Hey, that’s some really interesting ideas you got there! Good luck!

2 Likes

Hi,

Do you have a plan to integrate to “atom-ide” package?

Thanks

1 Like

Yeah. That would be cool. I’ll check it out after Atom 0.21 is released. The new file watching APIs might be really useful for caching module ASTs.

3 Likes

yeah, I had to turn off linter, because it is work too slow in any project bigger that an example.
Maybe you know any alternatives?

1 Like

I would like to thank you very, very, very much for this API! :wink: It’s really great and has what I think is lacking in Defold’s built-in editor, which I find very useful, but I was more and more unsatisfied with autocomplete. Hope it will be improved in future, especially adding autocomplete for lua tables which is super useful :slight_smile:

3 Likes