# Linting and Code Navigation in the code editor

**URL:** <https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465>\
**Category:** Announcements\
**Created:** [January 19, 2023, 9:54am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465 "2023-01-19T09:54:35Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![jorpak](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jorpak/32/30815_2.png) [@jorpak](https://forum.defold.com/u/jorpak)\
**Post date:** [February 17, 2023, 3:01pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/41 "2023-02-17T15:01:58Z")

</div>

I’m getting “line is too long (240 \> 120)”, is this anything to worry about?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 17, 2023, 3:16pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/42 "2023-02-17T15:16:54Z")

</div>

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:

> **[Configuration file — luacheck 0.26.0 documentation](https://luacheck.readthedocs.io/en/stable/config.html)**

---

<div class="post-metadata">

**Author:** ![vlaaad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vlaaad/32/10538_2.png) [@vlaaad](https://forum.defold.com/u/vlaaad)\
**Post date:** [March 22, 2023, 1:38pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/43 "2023-03-22T13:38:28Z")

</div>

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:

 ![Screenshot 2023-03-22 at 14.33.57](https://forum-defold.b-cdn.net/uploads/default/original/3X/2/d/2d1cb3a063a8d7e3719d5c86f85e46c342b9c44d.jpeg)

With workspace diagnostics, you get project-wide linting results in the “Build Errors” view.

To try it out:

1. Make sure you are using the latest version of the editor
2. Set language server dependency to a new URL — [https://github.com/defold/lua-language-server/releases/download/v0.0.4/release.zip](https://github.com/defold/lua-language-server/releases/download/v0.0.4/release.zip)

---

<div class="post-metadata">

**Author:** ![MasterMind](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mastermind/32/31839_2.png) [@MasterMind](https://forum.defold.com/u/MasterMind)\
**Post date:** [March 22, 2023, 5:00pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/44 "2023-03-22T17:00:50Z")

</div>

Works Great. This is awesome!

---

<div class="post-metadata">

**Author:** ![PrecisionRender](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/precisionrender/32/32654_2.png) [@PrecisionRender](https://forum.defold.com/u/PrecisionRender)\
**Post date:** [July 11, 2023, 10:01pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/45 "2023-07-11T22:01:22Z")

</div>

This is amazing!!! Thanks for implementing it! Is there any specific release in mind for its integration into the editor?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [July 12, 2023, 4:54am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/46 "2023-07-12T04:54:09Z")

</div>

> [@PrecisionRender](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![vlaaad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vlaaad/32/10538_2.png) [@vlaaad](https://forum.defold.com/u/vlaaad)\
**Post date:** [July 12, 2023, 8:12am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/47 "2023-07-12T08:12:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [July 12, 2023, 8:18am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/48 "2023-07-12T08:18:15Z")

</div>

This is really handy! Especially Shift F12, since I tend to do a file search to get this info. 🤩

 ![Screenshot 2023-07-12 at 09.14.43](https://forum-defold.b-cdn.net/uploads/default/original/3X/c/e/cef7f734cf0aa512341de53442bfb1e2ee1c06ab.png)

---

<div class="post-metadata">

**Author:** ![PrecisionRender](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/precisionrender/32/32654_2.png) [@PrecisionRender](https://forum.defold.com/u/PrecisionRender)\
**Post date:** [July 12, 2023, 4:10pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/49 "2023-07-12T16:10:19Z")

</div>

I tried it out and it works perfectly. Thanks!

---

<div class="post-metadata">

**Author:** ![ekt](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ekt/32/24576_2.png) [@ekt](https://forum.defold.com/u/ekt)\
**Post date:** [October 2, 2023, 7:46am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/50 "2023-10-02T07:46:15Z")

</div>

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](https://github.com/defold/lua-language-server/releases/download/v0.0.5/release.zip) to the dependencies.  
Is there any log I can check?

---

<div class="post-metadata">

**Author:** ![vlaaad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vlaaad/32/10538_2.png) [@vlaaad](https://forum.defold.com/u/vlaaad)\
**Post date:** [October 2, 2023, 9:44am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/51 "2023-10-02T09:44:08Z")

</div>

You can check logs in Help → Show Logs

---

<div class="post-metadata">

**Author:** ![ekt](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ekt/32/24576_2.png) [@ekt](https://forum.defold.com/u/ekt)\
**Post date:** [October 2, 2023, 10:45am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/52 "2023-10-02T10:45:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vlaaad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vlaaad/32/10538_2.png) [@vlaaad](https://forum.defold.com/u/vlaaad)\
**Post date:** [October 2, 2023, 11:02am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/53 "2023-10-02T11:02:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ekt](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ekt/32/24576_2.png) [@ekt](https://forum.defold.com/u/ekt)\
**Post date:** [October 2, 2023, 1:42pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/54 "2023-10-02T13:42:58Z")

</div>

> [@vlaaad](#):
>
> Language

No log that contains the word “Language”

---

<div class="post-metadata">

**Author:** ![ekt](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ekt/32/24576_2.png) [@ekt](https://forum.defold.com/u/ekt)\
**Post date:** [October 2, 2023, 1:46pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/55 "2023-10-02T13:46:06Z")

</div>

> [@vlaaad](#):
>
> can’t navigate

these two cases should work right?

common.lua

```lua
local M = {}

function M.some_function(x)
	return x + 1
end

return M

```

test.script

```lua
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

```

---

<div class="post-metadata">

**Author:** ![vlaaad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vlaaad/32/10538_2.png) [@vlaaad](https://forum.defold.com/u/vlaaad)\
**Post date:** [October 2, 2023, 1:54pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/56 "2023-10-02T13:54:16Z")

</div>

Hmm, shouldn’t it be `"main.common"` instead of `"main/common"`?

---

<div class="post-metadata">

**Author:** ![ekt](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ekt/32/24576_2.png) [@ekt](https://forum.defold.com/u/ekt)\
**Post date:** [October 2, 2023, 2:30pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/57 "2023-10-02T14:30:59Z")

</div>

I think both syntaxes are supported, or am I wrong? in any case the problem does not change even using the ‘.’

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [October 2, 2023, 7:05pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/58 "2023-10-02T19:05:47Z")

</div>

You should use “.” as that is universally the path separator, regardless of OS

---

<div class="post-metadata">

**Author:** ![ekt](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ekt/32/24576_2.png) [@ekt](https://forum.defold.com/u/ekt)\
**Post date:** [October 2, 2023, 7:34pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/59 "2023-10-02T19:34:41Z")

</div>

Understood. however the problem remains, f12 and shift-f12 do nothing.

---

<div class="post-metadata">

**Author:** ![vlaaad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vlaaad/32/10538_2.png) [@vlaaad](https://forum.defold.com/u/vlaaad)\
**Post date:** [October 2, 2023, 8:14pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/60 "2023-10-02T20:14:49Z")

</div>

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.

[Previous page](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465.md?page=2)

[Next page](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465.md?page=4)
