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.
- Compatibility Matrix
- Projects Powered by LSP4IntelliJ
- Quick Start
- Developer Guide
- Features
- License
- Contributors
- Inspiration
- Useful Links
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.1 – 0.96.2 |
2021.1 – 2024.2 | 3.17 |
0.95.0 |
2021.1 – 2024.2 | 3.16 |
0.94.0 – 0.94.2 |
2017.3 – 2020.3 | 3.14 |
0.1.0 – 0.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.
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.
- 1C:Enterprise BSL Language Support
- AWS Smithy IntelliJ
- Ballerina IntelliJ Plugin
- Cadence for IntelliJ Platform
- Chester IntelliJ Plugin
- CSL IntelliJ Extension
- DiveKit Language Plugin
- EO IntelliJ LSP Plugin
- IntelliJ Jsonnet
- IntelliJ V
- Marko.js IntelliJ Plugin
- nimtellij
- Robot Framework LSP (IntelliJ client)
- Seedwing Enforcer IntelliJ
- Spring Tools for IDEA
- Valkyrie IntelliJ
- WDL IDE
- Yarn Spinner JetBrains Plugin
- Yggdrasil IntelliJ
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"/>
<!-- required for file open/close and document-change sync with the language server -->
<editorFactoryListener implementation="org.wso2.lsp4intellij.listeners.LSPEditorListener"/>
<fileDocumentManagerListener implementation="org.wso2.lsp4intellij.listeners.LSPFileDocumentManagerListener"/>
</extensions>
<applicationListeners>
<!-- required for file open/close and document-change sync with the language server -->
<listener class="org.wso2.lsp4intellij.listeners.VFSListener"
topic="com.intellij.openapi.vfs.VirtualFileListener"/>
<listener class="org.wso2.lsp4intellij.listeners.LSPProjectManagerListener"
topic="com.intellij.openapi.project.ProjectManagerListener"/>
</applicationListeners>Note: On IntelliJ 2024.3+,
PreloadingActivityis no longer run, so register the server definition from aProjectActivitywired to thepostStartupActivityextension point.Note:
LSPEditorListener,LSPFileDocumentManagerListener, andVFSListenerare the minimum for the server connection and document sync to work at all;LSPProjectManagerListenerdisposes the project's language servers on project close so a stale status widget doesn't linger into the next project opened in the same window. Individual features (completion, diagnostics, rename, ...) need their own extension points — see resources/plugin.xml.example for the complete descriptor, or the Developer Guide for a walkthrough.
A green icon in the IDE's bottom-right confirms a successful connection.
The Developer Guide provides in-depth instructions and reference material for plugin authors, including:
- Step-by-step setup walkthrough
- Alternative server-definition styles —
RawCommandServerDefinitionandProcessBuilderServerDefinition - Custom LSP Initialization Parameters
- Request timeout tuning
- Legacy components-based setup
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.
The LSP Inspector is a tool window that shows, for each language server in the project:
- Log: status changes (starting, started, initialized, stopping, stopped) and crashes,
window/logMessageandwindow/showMessagenotifications from the server, and, when tracing is on, every JSON-RPC message in both directions. A traced response shows the method of the request it answers and the time between request and response, for exampletextDocument/hover (12) 38 ms. Error responses are shown at error level. - Server Info: the server's status, the name and version from its
initializeresponse, trace level, document sync mode, recent crash count and launch command, and which of the 17 requests LSP4IntelliJ sends the server advertised in itsServerCapabilities. - Requests: requests still waiting for a response, and per-method response times (count, errors, median, 95th percentile and maximum), recorded whether or not tracing is on.
- Timeouts: success and failure counts per request type.
- Connected Files: the files currently open on the server. Double-clicking one opens it.
The toolbar selects the server and filters the log by level and by source. Export Log saves the
selected server's Server Info details followed by its log, with the current filters applied. The
Trace dropdown
sets JSON-RPC tracing per server: OFF (the default) records nothing, MESSAGES records method, id
and direction, and VERBOSE also records each message's full payload. Changing it also sends
$/setTrace to the server.
Log capture runs whether or not the tool window is registered. Each server keeps up to 10,000 entries or 4,000,000 characters of text, whichever limit is hit first, dropping the oldest entries. A stopped server's log stays readable until a new instance of the same server starts logging. Response-time counts, error counts and maximums cover every response since the server was first started in the project, including across restarts; the median and 95th percentile cover each method's last 1,000 responses. The list of waiting requests is cleared each time the server starts.
The tool window is optional. To show it, register it in plugin.xml under the id LSP Inspector:
<extensions defaultExtensionNs="com.intellij">
<toolWindow id="LSP Inspector" anchor="bottom"
factoryClass="org.wso2.lsp4intellij.inspector.LspInspectorToolWindowFactory"/>
</extensions>Clicking the status bar icon offers Restart and the Trace levels for each server. With the tool window registered, it also offers Open LSP Inspector, and, while requests are waiting or after the server crashed, a shortcut to the Requests tab or to the log filtered to errors. Without it, those actions are not shown.
The LSP4Intellij code is distributed under the Apache license 2.0.
A huge thanks to all the amazing contributors! 🚀
LSP4IntelliJ is heavily inspired by the intellij-lsp plugin community.
Credits should go to the original author for his astounding work.