You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the language server executable to your `PATH`.
12
+
There are two ways of setting up the language server with `lsp-mode`:
13
+
- Add the language server executable to your `PATH`. This is useful for development and for always using the latest version from the `main`-branch.
14
+
- Let `lsp-mode` download the server for you (`kotlin-ls`). This will use [the latest release](https://github.com/fwcd/kotlin-language-server/releases/latest).
15
+
16
+
17
+
### Run/debug code lenses
18
+
If you use [dap-mode](https://github.com/emacs-lsp/dap-mode), you can set `(setq lsp-kotlin-debug-adapter-enabled t)` to enable the debug adapter. You will need to have [Kotlin Debug Adapter](https://github.com/fwcd/kotlin-debug-adapter) on your system. A simple configuration of `dap-mode` for Kotlin may look like:
19
+
```emacs-lisp
20
+
(require 'dap-kotlin)
21
+
(setq lsp-kotlin-debug-adapter-enabled t)
22
+
;; replace the path below to the path to your Kotlin Debug Adapter
Then you can activate `lsp-kotlin-lens-mode` to see the Run/Debug code lenses at your main-functions.
27
+
28
+
29
+
### Override members (e.g, toString and equals)
30
+
The language server provides a custom protocol extension for finding overridable members of a class (variables and methods). `lsp-mode` provides a function that uses this called `lsp-kotlin-implement-member`. You can run it while hovering a class name, and you will get a menu with all available overridable members. (protip: Bind this function to a key!). If you have [Helm](https://github.com/emacs-helm/helm) or [Ivy](https://github.com/abo-abo/swiper) installed, one of them will be utilized.
@@ -42,6 +62,25 @@ Add the following to your coc-settings.json file:
42
62
Note that you may need to substitute `kotlin-language-server` with `kotlin-language-server.bat` on Windows.\
43
63
You should also note, that you need a syntax highlighter like [udalov/kotlin-vim](https://github.com/udalov/kotlin-vim) or [sheerun/vim-polyglot](https://github.com/sheerun/vim-polyglot) to work well with coc.
44
64
65
+
## Neovim
66
+
67
+
Using Neovim's [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig), register
68
+
the language server using the following.
69
+
70
+
```lua
71
+
require'lspconfig'.kotlin_language_server.setup{}
72
+
```
73
+
74
+
If desired, you can also pass in your own defined options to the setup function.
75
+
76
+
```lua
77
+
require'lspconfig'.kotlin_language_server.setup{
78
+
on_attach=on_attach,
79
+
flags=lsp_flags,
80
+
capabilities=capabilities,
81
+
}
82
+
```
83
+
45
84
## Other Editors
46
85
Install a [Language Server Protocol client](https://microsoft.github.io/language-server-protocol/implementors/tools/) for your tool. Then invoke the language server executable in a client-specific way.
Copy file name to clipboardExpand all lines: README.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,11 +15,16 @@ Any editor conforming to LSP is supported, including [VSCode](https://github.com
15
15
16
16
* See [BUILDING.md](BUILDING.md) for build instructions
17
17
* See [Editor Integration](EDITORS.md) for editor-specific instructions
18
+
* See [Troubleshooting](TROUBLESHOOTING.md) for tips on troubleshooting errors
18
19
* See [Roadmap](https://github.com/fwcd/kotlin-language-server/projects/1) for features, planned additions, bugfixes and changes
19
20
* See [Kotlin Quick Start](https://github.com/fwcd/kotlin-quick-start) for a sample project
20
21
* See [Kotlin Debug Adapter](https://github.com/fwcd/kotlin-debug-adapter) for debugging support on JVM
21
22
* See [tree-sitter-kotlin](https://github.com/fwcd/tree-sitter-kotlin) for an experimental [Tree-Sitter](https://tree-sitter.github.io/tree-sitter/) grammar
[The original author](https://github.com/georgewfraser) created this project while he was considering using Kotlin in his work. He ended up deciding not to and is not really using Kotlin these days though this is a pretty fully-functional language server that just needs someone to use it every day for a while and iron out the last few pesky bugs.
@@ -103,6 +108,7 @@ The Kotlin language server supports some non-standard requests through LSP. See
Copy file name to clipboardExpand all lines: TROUBLESHOOTING.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,3 +32,13 @@ error TS6059: File '.../KotlinLanguageServer/bin/vscode-extension-src/...' is no
32
32
```
33
33
34
34
delete the `bin` folder in the repository directory.
35
+
36
+
37
+
## java.lang.OutOfMemoryError when running language server
38
+
The language server is currently a memory hog, mostly due to its use of an in-memory database for symbols (ALL symbols from dependencies etc.!). This makes it not work well for machines with little RAM. If you experience out of memory issues, and still have lots of RAM, the default heap space might be too low. You might want to try tweaking the maximum heap space setting by setting `-Xmx8g` (which sets the heap size to 8GB. Change the number to your needs). This can be done by setting the `JAVA_OPTS` environment variable.
39
+
40
+
41
+
In [the VSCode extension](https://github.com/fwcd/vscode-kotlin), this is in the extension settings in the setting `Kotlin > Java: Opts`.
42
+
43
+
44
+
If you use Emacs, you can try the `setenv` function to set environment variables. Example: `(setenv "JAVA_OPTS" "-Xmx8g")`.
0 commit comments