ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

LSP-kotlin

by sublimelsp ST4

Kotlin support for Sublime's LSP package

Labels lsp, java, kotlin

Details

Installs

  • Total 3K
  • Win 1K
  • Mac 1K
  • Linux 809
Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7
Windows 0 2 2 2 2 1 2 2 1 0 0 1 1 0 0 1 0 3 0 1 1 0 2 0 1 0 2 0 1 1 2 1 0 2 0 1 2 0 0 1 0 1 2 0 1 2
Mac 0 0 3 1 0 1 0 1 0 1 1 1 0 1 1 0 0 1 2 0 2 2 2 3 1 0 2 3 1 2 1 3 2 2 0 0 1 0 0 0 0 0 1 1 3 2
Linux 0 0 2 0 1 1 2 2 2 0 1 0 2 3 1 0 1 1 0 1 0 1 1 2 0 2 1 0 1 1 0 0 1 0 1 0 3 0 0 0 0 1 2 0 3 1

Readme

Source
raw.​githubusercontent.​com

LSP-kotlin

Kotlin support for Sublime's LSP plugin.

Uses the official Kotlin LSP from JetBrains to provide completion, diagnostics, formatting and other features for Kotlin files. See the linked repository for more information. Note that the server is currently in alpha.

Prerequisites

None — the server is downloaded and managed automatically (it bundles its own Java runtime, so a separate JDK is not required).

[!NOTE] The server is a large download: roughly 390 MB, expanding to about 1.2 GB on disk. It is fetched once, on first use, and reused afterwards.

If you would rather manage the server yourself (or share one copy across editors), install the kotlin-lsp CLI so it is available on your PATH and LSP-kotlin will use it instead of downloading its own copy:

  • Homebrew: brew install JetBrains/utils/kotlin-lsp
  • Manual: download the standalone zip from the releases page, unpack it, chmod +x kotlin-lsp.sh, and symlink it onto your PATH as kotlin-lsp (e.g. ln -s $KOTLIN_LSP_DIR/kotlin-lsp.sh $HOME/.local/bin/kotlin-lsp).

Installation

  • Install Kotlin, LSP and LSP-kotlin from Package Control.
  • Restart Sublime and open a Kotlin file — the server downloads on first use.

Configuration

Open the configuration file using the command palette with the Preferences: LSP-kotlin Settings command or from the Sublime menu (Preferences > Package Settings > LSP > Servers > LSP-kotlin).

The default command is ["${server_path}", "--stdio"], where ${server_path} resolves to a kotlin-lsp binary on your PATH if one is found (e.g. from Homebrew), and otherwise to the managed copy that is downloaded into the package's storage directory. To force a specific server, replace ${server_path} with an absolute path:

{
    "command": ["/opt/homebrew/bin/kotlin-lsp", "--stdio"]
}

Build tool

The server detects the build tool of the project automatically. When it finds more than one (for example both build.gradle.kts and pom.xml), it asks which one to use, and the status bar shows build tool required until you choose. To see the question again, run LSP-kotlin: Choose Build Tool from the command palette.

To store the choice, set build_tool in the project settings (Project > Edit Project):

{
    "settings": {
        "LSP": {
            "LSP-kotlin": {
                "build_tool": "gradle"
            }
        }
    }
}

Use null (the default) to detect the build tool automatically, or "" to not import the project.