# 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:** 4

<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, 8:26pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/61 "2023-10-02T20:26:29Z")

</div>

it’s literally the ‘Desktop game’ tutorial to which I added the dependency ‘[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)’ in game.project

[repro](https://drive.google.com/file/d/1IkiIKiqMMYEcOeFlk2spT4PpJCiA8zE2/view?usp=sharing)  
[logs](https://drive.google.com/file/d/17nkvXdLECGrmkuNf8_0HF11_qaYXHdRF/view?usp=sharing)

---

<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:47pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/62 "2023-10-02T20:47:29Z")

</div>

Thanks for sharing! There is nothing suspicious in the logs, and I tried the repro project and found code navigation working fine with F12/Shift F12. Have you tried restarting the Defold editor? 😃  
Also, can you share what OS you are using, and what is the editor version? E.g. what’s editor’s SHA1 in Help → About?

---

<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:49pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/63 "2023-10-02T20:49:23Z")

</div>

Also, could it be that you are using a custom keymap? File → Preferences, General tab, Path to Custom Keymap field.

---

<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, 9:05pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/64 "2023-10-02T21:05:26Z")

</div>

> [@vlaaad](#):
>
> Have you tried restarting the Defold editor?

yes of course

> [@vlaaad](#):
>
> editor version

2fa59062b9857a6eccefc43f2a90152b87c94847  
Windows 10

> [@vlaaad](#):
>
> you are using a custom keymap?

yes and you will find it attached. however neither f12 nor shift-f12 are remapped

---

<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 3, 2023, 5:26am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/65 "2023-10-03T05:26:54Z")

</div>

Keymap is probably the reason, you need to add F12 and Shift+F12 to your keymap file, see [defold/editor/src/clj/editor/keymap.clj at dev · defold/defold · GitHub](https://github.com/defold/defold/blob/dev/editor/src/clj/editor/keymap.clj) for reference

---

<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 3, 2023, 5:59am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/66 "2023-10-03T05:59:51Z")

</div>

I changed the mapping file by adding f12 and shift-f12 and now it works. two thoughts:

- I downloaded the mapping file from the link found in [https://defold.com/manuals/editor-keyboard-shortcuts/](https://defold.com/manuals/editor-keyboard-shortcuts/). Maybe you could consider keeping it updated
- I thought the mapping defined locally was **in addition** to the default one. as it is now, for every shortcut that you add one must remember to add them locally too. anyway this is a mapping issue, not a linter one

Thank you for taking the time to find the solution

---

<div class="post-metadata">

**Author:** ![Indie\_GmDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/indie_gmdev/32/27844_2.png) [@Indie\_GmDev](https://forum.defold.com/u/Indie_GmDev)\
**Post date:** [October 3, 2023, 9:43pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/67 "2023-10-03T21:43:05Z")

</div>

I tried copying the keycap.clj file vlaaad mentioned above.

It does not work and gives the error:  
“java.lang.UnsupportedOperationException: nth not supported on this type: Symbol.”

What am I missing or doing wrong? I do not know where the default keyboard map is located, so I thought setting this as the keyboard shortcut file was the only way I could fix this 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 5, 2023, 6:49am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/68 "2023-10-05T06:49:42Z")

</div>

You could try not using a custom keymap file altogether, then the F12/Shift+F12 binding will be set by the editor. Also, keymap file should not be a copy of keymap.clj, but instead it should only contain key combinations data, e.g. `[["A" :add] ["Alt+Backspace" :delete-prev-word] ...]`.

---

<div class="post-metadata">

**Author:** ![Indie\_GmDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/indie_gmdev/32/27844_2.png) [@Indie\_GmDev](https://forum.defold.com/u/Indie_GmDev)\
**Post date:** [October 6, 2023, 8:23am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/69 "2023-10-06T08:23:19Z")

</div>

Yeah, I tried not using a custom map, and F12 Shift+F12 did not work in that case either.

---

<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 6, 2023, 9:05am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/70 "2023-10-06T09:05:40Z")

</div>

Can you describe how exactly it does not work? What’s your dependency in game.project? What happens when you press F12 on a code you want to navigate to? What’s your editor version?

---

<div class="post-metadata">

**Author:** ![Indie\_GmDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/indie_gmdev/32/27844_2.png) [@Indie\_GmDev](https://forum.defold.com/u/Indie_GmDev)\
**Post date:** [October 6, 2023, 9:25am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/71 "2023-10-06T09:25:42Z")

</div>

For example, when I place the cursor over a function I want to navigate to the definition of and press F12, I get the message:

 ![Screenshot 2023-10-06 at 4.23.10 AM](https://forum-defold.b-cdn.net/uploads/default/original/3X/7/e/7e02c0e50936b3cc323f860a38e601714b1a9c38.png)

The game.project file has no dependencies.

The editor version is 1.6.0 (just updated it minutes ago).

---

<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 6, 2023, 9:37am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/72 "2023-10-06T09:37:45Z")

</div>

> [@Indie\_GmDev](#):
>
> The game.project file has no dependencies

Maybe the notification does not explain enough 😃  
As described in the top post in this thread, you need to add [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) as a dependency to game.project, then do `Project` → `Fetch Libraries`.

---

<div class="post-metadata">

**Author:** ![Indie\_GmDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/indie_gmdev/32/27844_2.png) [@Indie\_GmDev](https://forum.defold.com/u/Indie_GmDev)\
**Post date:** [October 6, 2023, 10:00am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/73 "2023-10-06T10:00:26Z")

</div>

OK, that worked! I must’ve messed up something when I tried Project \> Fetch Libraries before. I think I was trying to fetch from the downloaded version of release.zip file instead of getting it from the GitHub url. Or I think I also tried downloading the Lua language server, but it wasn’t your fork of it.

Anyway, thanks for the help!

---

<div class="post-metadata">

**Author:** ![jboadas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jboadas/32/34668_2.png) [@jboadas](https://forum.defold.com/u/jboadas)\
**Post date:** [January 23, 2024, 6:24pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/74 "2024-01-23T18:24:20Z")

</div>

Hello i am using Linux MX when hit F12 got this on the logs

```bash
2024-01-23 14:17:27.848 75701 [async-dispatch-5] WARN editor.lsp.server - {:line 423, :message "Language server failed", :launcher {:command ["build/plugins/lsp-lua-language-server/plugins/bin/x86_64-linux/bin/lua-language-server" "--configpath=build/plugins/lsp-lua-language-server/plugins/share/config.json"]}}
clojure.lang.ExceptionInfo: Client response timeout: initialize
	at editor.lsp.jsonrpc$unwrap_response.invokeStatic(jsonrpc.clj:222)
	at editor.lsp.jsonrpc$unwrap_response.invoke(jsonrpc.clj:213)
	at editor.lsp.server$make$fn __29908$state_machine__ 19619 __auto____ 29927$fn __29931$fn__ 29962$state_machine __19619__ auto ____30013$fn__ 30015.invoke(server.clj:400)
	at editor.lsp.server$make$fn __29908$state_machine__ 19619 __auto____ 29927$fn __29931$fn__ 29962$state_machine __19619__ auto ____ 30013.invoke(server.clj:400)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:978)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:980)
	at clojure.core.async.impl.ioc_macros$take_BANG_$fn__19637.invoke(ioc_macros.clj:989)
	at clojure.core.async.impl.channels.ManyToManyChannel$fn __15659$fn__ 15660.invoke(channels.clj:99)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at clojure.core.async.impl.concurrent$counted_thread_factory$reify __15562$fn__ 15563.invoke(concurrent.clj:29)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:833)

```

already have the dependency:  
 ![deps](https://forum-defold.b-cdn.net/uploads/default/original/3X/d/a/da6ee67631dd462402651314a4744004b58c559c.png)

after that clicked on “Fetch Libraries” and “Reload Editor Scripts”

restarted the editor, and still no luck, maybe i am missing a step.

best

---

<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:** [January 23, 2024, 6:38pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/75 "2024-01-23T18:38:39Z")

</div>

Can you try executing the command to start the language server (it’s in the logs you posted) in the project root too see if it responds with errors there?

```lua
./build/plugins/lsp-lua-language-server/plugins/bin/x86_64-linux/bin/lua-language-server

```

---

<div class="post-metadata">

**Author:** ![jboadas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jboadas/32/34668_2.png) [@jboadas](https://forum.defold.com/u/jboadas)\
**Post date:** [January 23, 2024, 6:55pm UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/76 "2024-01-23T18:55:29Z")

</div>

got this:

```bash
$ ./lua-language-server 
./lua-language-server: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./lua-language-server)
./lua-language-server: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./lua-language-server)

```

will try to solve these, thanks.

---

<div class="post-metadata">

**Author:** ![jboadas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jboadas/32/34668_2.png) [@jboadas](https://forum.defold.com/u/jboadas)\
**Post date:** [January 24, 2024, 12:17am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/77 "2024-01-24T00:17:55Z")

</div>

My distro is based on Debian 11 bullseye that have libc 2.31, to get a more recent version need to upgrade the distro.  
On the other hand i downloaded `lua-language-server-3.7.4-linux-x64` from  
[https://github.com/LuaLS/lua-language-server](https://github.com/LuaLS/lua-language-server)

and it works, wonder if there is a way to point the plugin to use different language server?

---

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [January 24, 2024, 4:08am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/78 "2024-01-24T04:08:59Z")

</div>

I just tried this, at first I press F12, I see a popup saying “Cannot perform this action because of there is no LSP Language Server running…”, then I add the dependency link to game.project, press Fetch Libraries and then now I press F12, nothing happens.. I don’t use a custom keymap either. What’s now? I even tried to restart the Editor but no help

---

<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:** [January 24, 2024, 10:20am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/79 "2024-01-24T10:20:58Z")

</div>

F12 is Go to Definition, but currently, it works only for navigating the Lua code that exists on disk, i.e. your own files, and not dependencies. Could it be that you tried navigating to dependency or built-in definitions?

---

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [January 24, 2024, 11:36am UTC](https://forum.defold.com/t/linting-and-code-navigation-in-the-code-editor/72465/80 "2024-01-24T11:36:32Z")

</div>

Ah I see, it seems there are some situations it’s not showing the definition. For example:

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

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