Skip to content

Update neovim docs #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for the Kotlin language.
The server is based on [IntelliJ IDEA](https://github.com/JetBrains/intellij-community) and the [IntelliJ IDEA Kotlin Plugin](https://github.com/JetBrains/intellij-community/tree/master/plugins/kotlin)
implementation.

### Quick Start
### VS Code Quick Start

1. Download the latest build of VSC extension or Standalone version from the [Releases Page](https://github.com/Kotlin/kotlin-lsp/releases)
2. Install it as a VSC Extension via `Extensions | More Action | Install from VSIX`
Expand All @@ -21,6 +21,16 @@ implementation.

![quickstart_sample.gif](images/quickstart_sample.gif)

### Install kotlin-lsp CLI

For brew users: `brew install JetBrains/utils/kotlin-lsp`

Manual installation:
1. Download the standalone zip from the [Releases Page](https://github.com/Kotlin/kotlin-lsp/releases)
2. Unpack zip
3. `chmod +x $KOTLIN_LSP_DIR/kotlin-lsp.sh`
4. Create a symlink inside your PATH `ln -s $KOTLIN_LSP_DIR/kotlin-lsp.sh $HOME/.local/bin/kotlin-lsp`

### Supported features and Roadmap

The best way to track current capabilities and what is going to be supported in the next builds is this table:
Expand Down
47 changes: 4 additions & 43 deletions scripts/neovim.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
# neovim setup
# Neovim setup

## stdio way

1. Ensure socat and netcat are installed

2. Ensure `kotlin-lsp.sh` is executable

```sh
chmod +x $KOTLIN_LSP_DIR/kotlin-lsp.sh
```

3. Create a symlink inside your `PATH` to `kotlin-lsp.sh` script, e.g.:

```sh
ln -s $KOTLIN_LSP_DIR/kotlin-lsp.sh $HOME/.local/bin/kotlin-ls
```

4. Configure [nvim.lsp](https://neovim.io/doc/user/lsp.html) e.g:
```lua
{
cmd = { "kotlin-ls", "--stdio" },
single_file_support = true,
filetypes = { "kotlin" },
root_markers = { "build.gradle", "build.gradle.kts", "pom.xml" },
}
```

## tcp way

Requires manual launch of language server

1. launch language server with `kotlin-lsp.sh` script

2. Configure [nvim.lsp](https://neovim.io/doc/user/lsp.html) e.g:
```lua
{
cmd = vim.lsp.rpc.connect('127.0.0.1', tonumber(9999)),
single_file_support = true,
filetypes = { "kotlin" },
root_markers = { "build.gradle", "build.gradle.kts", "pom.xml" },
}
```

1. [Install `kotlin-lsp` CLI](../README.md#install-kotlin-lsp-cli)
2. Install the official Neovim [`nvim-lspconfig` plugin](https://github.com/neovim/nvim-lspconfig)
3. Enable the LSP `vim.lsp.enable('kotlin_lsp')` in your `init.lua`