I’m getting “line is too long (240 > 120)”, is this anything to worry about?
Well, long lines are hard to read and could be a sign that you should split something like long if-statements into several shorter ones. But no, it is not an actual error.
You can disable this warning by creating a .luacheckrc
file in the root of your project and setting max_line_length
to either false (to disable the warning) or a larger number that you are comfortable with.
Read more about the config options and the .luacheckrc
file here:
An update for Defold linting capabilities is out now! The newly supported LSP feature is workspace diagnostics that we now perform when building the project:
With workspace diagnostics, you get project-wide linting results in the “Build Errors” view.
To try it out:
- Make sure you are using the latest version of the editor
- Set language server dependency to a new URL — https://github.com/defold/lua-language-server/releases/download/v0.0.4/release.zip
Works Great. This is awesome!
This is amazing!!! Thanks for implementing it! Is there any specific release in mind for its integration into the editor?
The latest version of the Lua LSP should work with any recent version of the Defold editor.
Ohh, completely forgot to share here… The editor now supports code navigation powered by Language Servers! Use F12 for Go to Definition and Shift F12 for Find References actions.
I tried it out and it works perfectly. Thanks!
I can’t get it to work. F12 gets me nowhere, shift-F12 shows no gui
- defold 1.6.0
- added https://github.com/defold/lua-language-server/releases/download/v0.0.5/release.zip to the dependencies.
Is there any log I can check?
You can check logs in Help → Show Logs
I didn’t explain myself well. I know where the logs are, I was wondering if there are any particular logs I should look for related to the problem
You could look for messages like “Language server process failed to start”, or “Language server failed”.
Also, note that the Lua language server can’t navigate to built-in Defold Lua functions or to functions from library dependencies.
No log that contains the word “Language”
these two cases should work right?
common.lua
local M = {}
function M.some_function(x)
return x + 1
end
return M
test.script
local common = require "main/common"
local function get_some_number()
return 42
end
function init(self)
local x = common.some_function(1)
local num = get_some_number()
end
Hmm, shouldn’t it be "main.common"
instead of "main/common"
?
I think both syntaxes are supported, or am I wrong? in any case the problem does not change even using the ‘.’
You should use “.” as that is universally the path separator, regardless of OS
Understood. however the problem remains, f12 and shift-f12 do nothing.
Please share a small repro project that shows the issue, e.g. a game.project with dependency and a couple of lua files where the LSP doesn’t work. Also would be nice if you shared the editor logs, maybe there are some hints about why it doesn’t work.