Lua autocomplete for Atom

There are a number of other packages that are useful, like linter-lua and linter-luacheck, but I don’t want to add them straight to dependencies because I don’t want to lock users into having to have these packages installed. Maybe I should add them as recommendations to the readme.

3 Likes

yeah. it would be really great. i’m new to atom.io so don’t know what is a good practise and must have plugins and this info will be really useful.

In the latest updates:

  1. Code after the current line should now be parsed in the general case (it will still fail if you have unclosed blocks or other forms of syntax errors)

  2. I added type tracking to function arguments. In particular, self is now tracked across all Defold lifecycle functions:

13 Likes

Awesome work as always! Thank you for your contribution to the community

4 Likes

Awesome! Doing a little dance here! https://media.giphy.com/media/10pHteyVCBH6uI/giphy.gif

5 Likes

@dapetcu21
Hi, maybe you know how to make Go To Declaration for lua code? If it’s possible, of course.

1 Like

@dapetcu21 Hi, thanks for brilliant work!!! :slight_smile:

I’m now using your plugin with linter-lua and linter-luacheck (you mentioned above) on Ubuntu,
but have a problem that every built-in references are marked as warning…

Is there some way to get rid of these errors? (by configuration or something)
I think it’s just because linter don’t know about built-ins, so I think I can fix it,
but I’m new to Atom so I can’t feature where to start :frowning:

EDIT:
I just read your github README, and I can remove all errors by .luacompleterc.
But should I put all functions/tables on this config file?

Hi.

You don’t need to have a .luacompleterc. Just install defold-ide and that should give you the definitions for all the Defold standard functions. But this won’t help you with the linter, though.

You need to configure linter-luacheck separately with a .luacheckrc file. This is the one that I use: https://github.com/dapetcu21/breakthrough-ai/blob/master/.luacheckrc

2 Likes

Sorry. I just realised I forgot to answer your question. My apologies.

It would certainly be possible to make Go To Declarations with the current type system, but would require me to keep track of file locations for each type and then do queries on this. It would be a cute nice-to-have, but I don’t feel the amount of work is justifiable for me. (as I generally don’t use Go To Declarations when I code since it’s generally faster to just search for the term with “/” in vim-mode)

1 Like

Can you include a guide on how to get this to work with Defold? I installed the defold-ide package but it won’t autocomplete anything for me.

Thanks in advance.

I get it to work without problems… have you also installed autocomplete-lua and language-lua packages? They are dependencies of defold-ide. You shouldn’t need anything else…

2 Likes

It should just work after defold-ide automatically installs autocomplete-lua and language-lua and after it downloads the Defold API reference docs.

5 Likes

Thanks, it for some reason wasn’t installing dependencies.

I did it manually and it worked. :slight_smile:

2 Likes

Hi! i’m beginner game developer. I use game maker studio and I’m experiencing the Defold. When installing defold-ide, it installs language-lua but fails to install autocomplete-lua. It says: Failed to install defold-ide dependencies
These packages were not installed, check your console
For more info.
• autocomplete-lua
And after that I can no longer find the autocomplete-lua in the install package

can you help me?

1 Like

Hi. Try installing autocomplete-lua manually from Settings -> Install or with apm install autocomplete-lua. If that fails, try deleting the ~/.atom/packages/autocomplete-lua directory (~ means your home folder), and then reinstalling.

If you can’t get it to install, check Atom’s console for errors. You can do that from View -> Developer -> Show Developer Tools. On macOS the key shortcut is Cmd-Alt-I.

4 Likes

Thanks for making this, it’s awesome! It makes working with Defold soooo much nicer.

7 Likes

I’m working on a refactor to the type system, which should allow for more flexibility with type inference. I have some cool plans for it as well. #hype

I’m also adding tests to make sure I’m not breaking anything and adding flow type annotations to increase code readability. #responsibleCoding

9 Likes

@dapetcu21
I really like your plugin! Thank you!
Atom now is my main editor for lua (Defold).

But hot reload doesn’t work for me (
I already download bob.jar and added path into field.
When I tap to cmd+r I see “Hot reloading” message, but nothing change in my running build (dmengine on mac).

1 Like

Hi. I’ll take a look tomorrow. Haven’t tested with the latest version of Defold, so stuff might have broke. Make sure you have the latest bob.jar.

2 Likes

@dapetcu21
Hello, I’ve been using your plugin for a while now and i really like it, it works really well. But one thins that I haven’t gotten to work in Atom and maybe something you could add in the plugin is a way of navigation to the definition of a functions/variables etc. (i.e ctrl/cmd + click)
Another nice feature would be refactor/renaming within know scope.

Again, thanks for an awesome plugin!

7 Likes