|
1 |
| -# neovim setup |
| 1 | +# Neovim setup |
2 | 2 |
|
3 |
| -## stdio way |
4 |
| - |
5 |
| -1. Ensure socat and netcat are installed |
6 |
| - |
7 |
| -2. Ensure `kotlin-lsp.sh` is executable |
8 |
| - |
9 |
| - ```sh |
10 |
| - chmod +x $KOTLIN_LSP_DIR/kotlin-lsp.sh |
11 |
| - ``` |
12 |
| - |
13 |
| -3. Create a symlink inside your `PATH` to `kotlin-lsp.sh` script, e.g.: |
14 |
| - |
15 |
| - ```sh |
16 |
| - ln -s $KOTLIN_LSP_DIR/kotlin-lsp.sh $HOME/.local/bin/kotlin-lsp |
17 |
| - ``` |
18 |
| - |
19 |
| -4. Configure [nvim.lsp](https://neovim.io/doc/user/lsp.html) e.g: |
20 |
| - ```lua |
21 |
| - { |
22 |
| - cmd = { "kotlin-lsp", "--stdio" }, |
23 |
| - single_file_support = true, |
24 |
| - filetypes = { "kotlin" }, |
25 |
| - root_markers = { "build.gradle", "build.gradle.kts", "pom.xml" }, |
26 |
| - } |
27 |
| - ``` |
28 |
| -
|
29 |
| -## tcp way |
30 |
| -
|
31 |
| -Requires manual launch of language server |
32 |
| -
|
33 |
| -1. launch language server with `kotlin-lsp.sh` script |
34 |
| -
|
35 |
| -2. Configure [nvim.lsp](https://neovim.io/doc/user/lsp.html) e.g: |
36 |
| - ```lua |
37 |
| - { |
38 |
| - cmd = vim.lsp.rpc.connect('127.0.0.1', tonumber(9999)), |
39 |
| - single_file_support = true, |
40 |
| - filetypes = { "kotlin" }, |
41 |
| - root_markers = { "build.gradle", "build.gradle.kts", "pom.xml" }, |
42 |
| - } |
43 |
| - ``` |
44 |
| - |
| 3 | +1. [Install `kotlin-lsp` CLI](../README.md#install-kotlin-lsp-cli) |
| 4 | +2. Install the official Neovim [`nvim-lspconfig` plugin](https://github.com/neovim/nvim-lspconfig) |
| 5 | +3. Enable the LSP `vim.lsp.enable('kotlin_lsp')` |
0 commit comments