Skip to content

ballerina-platform/lsp4intellij

Repository files navigation

LSP4IntelliJ — LSP Client Library for JetBrains Plugins

Build status JitPack License IntelliJ IDEA GitHub last commit Gitter

LSP4IntelliJ is a client library that brings Language Server Protocol (LSP) support to IntelliJ IDEA and other JetBrains IDEs.

Designed for plugin developers, it streamlines LSP integration and supports language-specific extensions over the JSON-RPC protocol.


Table of Contents


Compatibility Matrix

The table below groups released lsp4intellij artifacts by the IntelliJ IDEA version range they are known to be compatible with and the LSP specification version they support (derived from the bundled org.eclipse.lsp4j runtime). Because lsp4intellij is consumed as a library, your plugin's own plugin.xml ultimately controls runtime compatibility — but picking a library version whose range overlaps your plugin's target avoids API surface mismatches.

LSP4IntelliJ Compatible IDEA versions Supported LSP spec
0.95.10.96.2 2021.1 – 2024.2 3.17
0.95.0 2021.1 – 2024.2 3.16
0.94.00.94.2 2017.3 – 2020.3 3.14
0.1.00.92.1 2017.3 – 2020.3 3.13

Note: Ranges reflect the IDEA versions covered while each release line was actively maintained. No upper bound (untilBuild) is enforced in the artifact itself, so newer IDEs are not artificially blocked — but compatibility outside the listed range is unverified and depends on whether the IntelliJ Platform APIs used by the library remain available in the target IDE.


Projects Powered by LSP4IntelliJ

Here are some open-source projects that use lsp4intellij to integrate their language servers. Feel free to open a PR to add or remove an entry.


Quick Start

The minimum integration is three pieces: add the dependency, register a language server from a startup activity, and wire that activity into plugin.xml. Replace the command and file extension with your own.

build.gradle — see JitPack for Maven and SBT snippets.

implementation 'com.github.ballerina-platform:lsp4intellij:<version>'

Startup activity

public class MyLspStartup implements ProjectActivity {
    @Nullable
    @Override
    public Object execute(@NotNull Project project, @NotNull Continuation<? super Unit> continuation) {
        IntellijLanguageClient.addServerDefinition(
            new RawCommandServerDefinition("mylang", new String[]{"path/to/language-server"}));
        return Unit.INSTANCE;
    }
}

plugin.xml

<extensions defaultExtensionNs="com.intellij">
    <postStartupActivity implementation="com.example.MyLspStartup"/>
</extensions>

Note: On IntelliJ 2024.3+, PreloadingActivity is no longer run, so register the server definition from a ProjectActivity wired to the postStartupActivity extension point.

A green icon in the IDE's bottom-right confirms a successful connection.


Developer Guide

The Developer Guide provides in-depth instructions and reference material for plugin authors, including:


Features

LSP4IntelliJ supports a wide range of LSP capabilities.

See the Features guide for descriptions, triggers, and demos of each capability.

Note: Features are mainly tested on IntelliJ IDEA.


License

The LSP4Intellij code is distributed under the Apache license 2.0.

Contributors

A huge thanks to all the amazing contributors! 🚀

Inspiration

LSP4IntelliJ is heavily inspired by the intellij-lsp plugin community. Credits should go to the original author for his astounding work.

Useful Links

About

This language client library provides language server protocol support for IntelliJ IDEA and other Jetbrains IDEs.

Topics

Resources

License

Stars

477 stars

Watchers

79 watching

Forks

Packages

 
 
 

Contributors

Languages