I created a Defold IntelliJ plugin [testers needed]

Hey folks :waving_hand:

You can install it from the marketplace: https://plugins.jetbrains.com/plugin/29184-defold-support.

More details on its README: GitHub - aridclown/Intellij-Defold: Defold coding and debugging support in IntelliJ

So far, it supports:

  • :file_folder: Project awareness – Detects Defold workspaces and keeps paths in sync.
  • :brain: Smart Lua editing – EmmyLua2 + LSP4IJ provide completion, annotations, syntax highlighting, linting, navigation, refactors, and other editor goodies for your Lua scripts.
  • :page_facing_up: Script templates – Create scripts from IntelliJ with the expected boilerplate.
  • :beetle: Debugger – Full mobdebug experience without starting the Defold editor: conditional breakpoints, run-to-cursor, expression evaluation, watches, inline values, call stacks, and coroutine support.
  • :rocket: Build + Run + Debug – Trigger clean, build, run, and debug from IntelliJ with automatic engine launching and port management.
  • :fire: Hot reloading – Reflect changes to Lua scripts with a simple hotkey.
  • :desktop_computer: Multi-platform – Works on Windows, macOS, (Linux untested).

Why?

As someone who has been using IntelliJ for over a decade, when I first started exploring Defold, I found it a bit challenging to adapt to VS Code.

Although I really appreciate all the effort the community has put into VS Code, I’ve never quite felt at home with that editor.

Anyways, it felt like the perfect time to start an IntelliJ plugin that goes a little beyond code highlighting.

No wheels reinvented?

I was sure to verify that we didn’t already have something started in the open-source community (GitHub), but I couldn’t find anything.

The projects I found are mainly focused on type checking, syntax highlighting, Lua annotations, and autocomplete:

  • IntelliJ-EmmyLua → the most mature plugin for Lua development in IntelliJ.
    • Most people use EmmyLua (version 1), which is great. However, it has a few drawbacks, particularly in terms of performance.
  • IntelliJ-Luanalysis → an EmmyLua fork for statically typed Lua.
    • It’s not been maintained for a while, it doesn’t work in the latest versions of IntelliJ, and most of its features are already supported by EmmyLua2.
  • @d954mas’s Defold-api-emmylua → a Defold API annotations generator for IntelliJ.
    • I wanted to remove the friction of manually having to generate these whenever a new Defold version pops up.

However, I wanted something more comprehensive, specifically that allowed me to leverage IntelliJ’s excellent debugging features. So I decided to make it from scratch.

Why EmmyLua?

The ā€˜Defold Support’ plugin is built on top of Intellij-EmmyLua2, which is much faster than its first version, has better support for type checking, supports various Lua versions (including Luajit), and leverages LuaLS instead of local Lua annotations for code completion, syntax highlighting, error detection, code navigation, etc.

It’s a mature and well-maintained ecosystem. The repository owner is super responsive, so whenever we hit a roadblock, we can help improve their repository (I’ve done it a few times already). Maturing Lua in the IntelliJ ecosystem means Defold in IntelliJ benefits as well.

What now?

While I made sure to test the plugin extensively, I’m sure I missed some important scenarios or didn’t catch all the bugs.

If you enjoy coding with IntelliJ as much as I do, I would appreciate your input and feedback on testing the plugin. Please share how it works with your Defold workflows, any missing features, desired additions, or potential bugs.

For instance, I haven’t tested it on Linux yet, so Linux users would be especially helpful :folded_hands:

9 Likes

I’ll have a go and see if I have a better time with Intellij than with VS Code. I’m on Linux. :wink:

Is this what the default Defold configurations do? I expected to see multiple Defold related configurations but instead it is empty. Not sure if a bug or intended. When I added a Defold configuration and ran it I get an error for some reason. I have only ever build from the editor so I don’t know much about bob.

ERROR:SCRIPT: log/log.lua:334: attempt to index global 'chronos' (a nil value)
stack traceback:
  log/log.lua:334: in function get_logger
  log/log.lua:365: in main chunk
  [C]:-1: in function require
  main/scenes/main/main.script:3: in main chunk

Arch Linux / Defold 1.11.2 / IntelliJ IDEA 2025.2.4 (Community Edition)

No other issues after a quick test afaik.

Edit: One thing I miss is this: Annotations Ā· LuaLS/lua-language-server Wiki Ā· GitHub automatically adding the annotation lines based on the function params after typing `---`is such a time saver. Not sure if this would need to be added in the emmylua ls though.

Also seems when pressing enter on a line that starts with ---does not automatically add new dashes on the next line. Not sure if this is a configuration thing somewhere hidden.

2 Likes

This looks like if the dependencies have not been fetched/downloaded (you can do that from bob using the fetch resolve command).

1 Like

You mean using the ā€œresolveā€ command in bob.jar?

Yes, thanks, updated my answer

1 Like

Cleaning doesn’t need to be the default behavior (I’m not sure whether you made it default or if users can configure it). We invested a lot of work into making cache invalidation reliable, and even in the editor we avoid performing a clean in most situations.

1 Like

That’s a good call! I never added the option for resolving the dependencies, so it seems like a good menu option, just like VS Code extension has done.

@NaakkaDev I’m gonna work on an update to include that, thank you very much for testing it out on Linux.

Thanks for the call. I have not. Today, the actions are mapped as follows:

  • Build: runs bob with build
  • Clean Build: runs bob with distclean
  • (TBD) Resolve: runs bob with resolve

2 Likes

I tried to set the beta build for the ā€œDefold install directoryā€ and this happens when intellij is opened (makes sense though):

Failed to fetch Defold annotations release asset url

org.json.JSONException: JSONObject["assets"] not found.

image

Another thing (1.11.2); I renamed my .emmyrc.json file, that I used with VS Code & Emmylua. Everything blow up. :smiley: All the defold globals are now unknown etc. I presume the defold annotations are somewhere where emmylua doesn’t look for them by default. I wonder if the plugin should create an .emmyrc.json file with related configs if its missing from the project root. Or maybe it wouldn’t be needed and something is broken.

Edit: Did not notice that the plugin would create a .luarc.json file. I had one so it didn’t and that resulted to derps.

Testing! I’m so thankful for your work on this plugin, as I’m also a long time Jetbrains IDE user :slight_smile:

1 Like