Linting and Code Navigation in the code editor

Today we’ve released a new version of the editor that can show lints in the code editor. The linting is implemented using Language Server Protocol, which hopefully will enable us to add more improvements to the code editor in the future.

To try out the linting, you first need to ensure you are running the latest version of the editor and then add this dependency in your game.project:

UPDATE #1: A newer version will allow the editor to lint the whole project when building it.

UPDATE #2: The editor now supports code navigation powered by Language Servers. Use F12 for Go to Definition and Shift F12 for Find References actions.

UPDATE #3: We now include code completions from language servers in the code completion popup.

UPDATE #4: Now Lua language server is built into the editor.

Once you add the dependency, you need to perform Project → Fetch Libraries and Project → Reload Editor Scripts actions.

Then, the editor will use our fork of sumneko’s lua-language-server that uses Luacheck to lint your edited files.

Additionally, we updated our editor scripts manual with new language servers section that describes how to add other language servers to do linting in the editor. For example, I experimented with using vscode’s JSON language server, to lint JSON files with JSON schema. I didn’t make it an extension though because it needs a nodeJS runtime to run which is like 80 Mb per platform. Another interesting language server to integrate into Defold would be a linter for our shader files, maybe based on glsl-language-server or something similar.

Try it out and tell us what you think!


This is great! Looking forward to trying it.

Out of curiosity, will this stay as an extension or will it be integrated with the editor directly?


Wow! :star_struck:

Is it for beta 1.4.2 or stable 1.4.1 release Editor?


Long-term: once we add support for code features like goto definition/find references, we will integrate the lua-language-server into the editor distribution.


Currently it’s in 1.4.1 stable, but it should be in the beta soon (I merged into beta awhile ago, it’s being built on CI).


Really good so far! Have tidied up my scripts quite a bit already.


Is there a window that shows all problems from linter?

1 Like

No, there is only highlighting in the code file


This is will be added in an upcoming release!


Gave it a try and it is working great.

I think this would be an excellent addition. For those wanting to explore and learn about shaders for the first time and experienced users as well.


Thank you so much! I thought that I was writing the perfect code (I’m kidding :grin: ) - the linter detected some really weird bugs.

Overall, it works great! Will it support .script_api from third-party extensions? Now the linter highlights the calls to native extensions as accessing undefined variable.

Plus, the console log syntax highlighting has been missing since the linter update -


I wrote down in the linter issue that we want to pipe .script_api information to the language server, thanks for reminding me about it :slight_smile:

Regarding console syntax highlighting, as we discussed in the issue, the fix should be released soon.

I’m so glad linting is useful!!!


Is there a way to customize the LuaCheck options?

Create and edit the .luacheckrc file in the project root.

1 Like

I don’t understand how to make this work. I added the module as a project dependency and reloaded editor scripts but nothing changed or pops up while in the script editor.

What is your editor sha in Help → About? Are there errors in today’s log file (Help → Show Logs)?

It’s this file: Configuration file — luacheck 0.26.0 documentation

1 Like

sha: e0ad4769ad5b83c60b185b54ff889f4437b0d128

I do see an error here:

2023-01-20 20:09:19.895 25585 [async-dispatch-8] ERROR editor.lsp.server - {:line 226, :message "Language server process failed to start", :launcher {:command ["./build/plugins/lsp-lua-language-server/plugins/bin/x86_64-win32/bin/lua-language-server.exe" "--configpath=build/plugins/lsp-lua-language-server/plugins/share/config.json"]}} Cannot run program "C:\Users\MyName\Documents\Game Development\Defold\Projects\Games\MyGame\.\build\plugins\lsp-lua-language-server\plugins\bin\x86_64-win32\bin\lua-language-server.exe" (in directory "C:\Users\MyName\Documents\Game Development\Defold\Projects\Games\MyGame"): CreateProcess error=2, The system cannot find the file specified
	at java.base/java.lang.ProcessBuilder.start(
	at java.base/java.lang.ProcessBuilder.start(
	at editor.lsp.server$fn__28420.invokeStatic(server.clj:77)
	at editor.lsp.server$fn__28420.invoke(server.clj:69)
	at editor.lsp.server$fn__28405$G__28400__28412.invoke(server.clj:66)
	at editor.lsp.server$make$fn__28803$state_machine__19501__auto____28820$fn__28824$fn__28832.invoke(server.clj:224)
	at clojure.core.async$thread_call$fn__19752.invoke(async.clj:484)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/
Caused by: CreateProcess error=2, The system cannot find the file specified
	at java.base/java.lang.ProcessImpl.create(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(
	at java.base/java.lang.ProcessImpl.start(
	at java.base/java.lang.ProcessBuilder.start(
	... 10 common frames omitted
2023-01-20 20:09:19.919 25609 [clojure-agent-send-off-pool-2] INFO  editor.boot-open-project - {:line 408, :message "project loaded"}
2023-01-20 20:09:20.285 25975 [JavaFX Application Thread] INFO  editor.defold-project - {:line 890, :message "Cached save data in system cache.", :total 189, :retained 154, :unretained 35, :limit 20000}

Can you please check that path and see if it is missing the file or of it perhaps is a permission issue?

Could you try a path without a space ” ” in it?