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
: https://github.com/defold/lua-language-server/releases/download/v0.0.5/release.zip
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!