Lua autocomplete for Atom

Oh! Well, it wouldn’t have helped me too much anyway if pyfold uses bob internally. It’s more convenient to call bob directly from JS and not have to worry about passing through yet another dependency that needs to be maintained and updated. I guess I could implement Build & Run by running a build with bob, then starting up dmengine (although I don’t know the specific details of how to do that), but I think it might be a bit outside the scope of this package for now. Hot reloading is more than enough to make the code editing pleasant.

1 Like

(sry for briefly hijacking this thread)
If interested in a similar (but lighter) library I created one last week when streaming that streamlines building, bundling, running and uploading app to google drive, all with custom game.project settings.

But yeah, it adds more dependencies.

1 Like

That sounds pretty useful. Any links?

2 Likes

Awesome project, really cool! :smiley:

As you previously pointed out, it should be possible to trigger both building and bundling through Bob.jar. Here is some information on Bob: http://www.defold.com/manuals/bob/

And if anything is missing, just ask! :thumbsup:

2 Likes

I finally managed to get the thing working. 0.7.0 now autocompletes modules. It’s still a bit rough around the edges (for example, perf could benefit from some caching in more areas than one), but it works and it’s a bit awesome that I can do this:

12 Likes

Thank you very much Dapetcu21.
I feel really pleasure to coding in Atom using your plugins. It’s really handy especially with autocomplete popup. so with my bunch of constants (message names) I don’t need to use “find” and mouse to open files and switch back as i did that in native defold editor.

I didn’t see new editor and coding features there but I hope you will continue develop this plugin.

5 Likes

Hi. So, first I’d like to thank everyone for using this. I’ve been doing some heavier Defold dev this past week and I’ve been using autocomplete-lua (eating my own dog food here) and I’m pretty happy with the experience. It seems that performance is ok even without module and settings caching.

So I’m wondering if it makes sense right now to still work on caching. Are any of you with big projects or slower/HDD machines feeling you could benefit from faster autocomplete triggering?

Or generally, do you have any suggestions of useful nice-to-haves?

4 Likes

I tried on some large Lua modules containing generated API code (~16000 LOC) and the plugin works perfectly. I have yet to come across any situation where the performance was bad.

The real crown jewel of nice-to-haves is if the plugin can auto-complete from require’d modules.

3 Likes

But it already does that. It parses required files as well.

1 Like

It does? I’m using 0.7.0 of autocomple-lua.

Under Planned Features on the Settings page it says: “Autocomplete required modules”

Also, if you take the following example:

local M = {}

function M.a()
end

function M.b()
	M.		<--- I would expect it to show not only a() here, but also c()
end

function M.c()
end

return M

I forgot to update the readme when I made the release. The readme is now up to date on master, but Atom shows the last released version.

What you’re seeing is a side effect of the fact that it parses only up to the current line. It was easier to implement this way. I am planning to change that, but I have yet to come up with an elegant solution.

1 Like

Ok, I see. But are you saying that the version available for installation from within Atom should be able to auto-complete from required modules? I’m not getting that to work.

Yup. It should, as long as defold-ide detects your project root correctly. Otherwise, it will assume all module paths start in the current file’s directory. If defold-ide finds your project root, you should also have completion for Defold functions. Do you have that?

3 Likes

Ah, yes, now it’s working as expected. Thanks!

1 Like

At long last, I can now make Defold games with Atom’s power-mode.

4 Likes

Lol. I just now noticed this thread is featured on Defold’s homepage. Thanks guys! :smiley:

9 Likes

Hi. maybe you know why symbols-view (core atom package) works good with .lua files, and doesn’t work with .script and other defold files?

Huh. You’re right. It doesn’t work. I don’t use symbols-view myself, but it seems that goto works. symbols-view is ctags-based and seems to come with ctags binaries pre-bundled. Maybe ctags doesn’t recognise .script files as Lua even though Atom does?

2 Likes

Thank you! Goto works good!

would be great to see next time this dependency in your defold ide =). I faced the same problem with hard navigation from function to function.