Skip to content

Commit b7f01e6

Browse files
committed
doc: neovim troubleshooting findings
1 parent 6d9e61b commit b7f01e6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

TROUBLESHOOTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,47 @@ The language server is currently a memory hog, mostly due to its use of an in-me
77
In [the VSCode extension](https://github.com/fwcd/vscode-kotlin), this is in the extension settings in the setting `Kotlin > Java: Opts`.
88

99
If you use Emacs, you can try the `setenv` function to set environment variables. Example: `(setenv "JAVA_OPTS" "-Xmx8g")`.
10+
11+
## Neovim / Mason LSP
12+
13+
In case you see the following in your `lsp.log`;
14+
15+
```
16+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "java.util.concurrent.CompletionException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $"
17+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)"
18+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)"
19+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770)"
20+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)"
21+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)"
22+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat java.base/java.lang.Thread.run(Thread.java:1583)"
23+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $"
24+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:397)"
25+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat com.google.gson.Gson.fromJson(Gson.java:1227)"
26+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat com.google.gson.Gson.fromJson(Gson.java:1329)"
27+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat com.google.gson.Gson.fromJson(Gson.java:1271)"
28+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat org.javacs.kt.ConfigurationKt.getStoragePath(Configuration.kt:81)"
29+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat org.javacs.kt.KotlinLanguageServer.initialize$lambda$6(KotlinLanguageServer.kt:97)"
30+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat org.javacs.kt.util.AsyncExecutor.compute$lambda$2(AsyncExecutor.kt:19)"
31+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)"
32+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\t... 3 more"
33+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $"
34+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat com.google.gson.internal.bind.JsonTreeReader.expect(JsonTreeReader.java:165)"
35+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat com.google.gson.internal.bind.JsonTreeReader.beginObject(JsonTreeReader.java:89)"
36+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\tat com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:386)"
37+
[ERROR][2025-09-28 09:46:29] ...lsp/handlers.lua:562 "\t... 10 more"
38+
```
39+
40+
The solution is to provide the following LSP config where
41+
`init_options.storagePath` is defined.
42+
43+
```lua
44+
require("mason-lspconfig").setup_handlers {
45+
["kotlin_language_server"] = function ()
46+
require("lspconfig")["kotlin_language_server"].setup {
47+
init_options = {
48+
storagePath = vim.fn.stdpath("data") .. "/kotlin-language-server",
49+
}
50+
-- etc...
51+
}
52+
}
53+
```

0 commit comments

Comments
 (0)