Development IntelliJ IntelliJ IDEA Internals Plugins

Language Server Protocol (LSP) for Plugin Developers

Read this post in other languages:

All details related to the Language Server Protocol (LSP) support in the IntelliJ Platform are now available in the IntelliJ SDK Docs.

The Language Server Protocol (LSP) is an open-standard protocol developed by Microsoft. It enables communication between development tools and Language Servers. Language Servers can provide language-specific features such as code completion, documentation, and formatting, which is far easier than implementing language support from scratch.
It also reduces the need for constant maintenance and tracking of changes in relevant languages and tools, making it easier to bring consistent language support to various development environments.

However, the canonical custom language support provided by IntelliJ Platform still offers a wider range of integration with IDE features than handling and presenting data provided by a Language Server.
Therefore, the LSP approach shouldn’t be considered as a replacement for the existing language API, but rather as an added value.

Supported IDEs

The integration with the Language Server Protocol is created as an extension to the paid IntelliJ-based IDEs.
Therefore, plugins utilizing Language Server integration are not available in Community releases of JetBrains products and Android Studio from Google.

Starting with the 2023.2 release cycle, the LSP API is publicly available as part of the IntelliJ Platform in the following IDEs:
IntelliJ IDEA Ultimate, WebStorm, PhpStorm, PyCharm Professional, DataSpell, RubyMine, CLion, Aqua, DataGrip, GoLand, Rider, and RustRover.

Plugin configuration

To fully utilize the LSP API in a third-party plugin based on the Gradle IntelliJ Plugin, it is required to upgrade it to the latest version available.
This plugin will attach the LSP API sources and code documentation to the project.

As LSP became available in the 2023.2 EAP7 of IntelliJ-based IDEs, the plugin must target IntelliJ IDEA Ultimate 2023.2 or later.

All examples of LSP integration are available in the IntelliJ SDK Docs.

Integration Overview

Integrating the Language Server Protocol (LSP) into a plugin for IntelliJ-based IDEs involves a trade-off between simple and fast language support and a complex custom language support plugin with IDE capabilities.

When considering the LSP-based approach, it is important to assess the following criteria for providing a Language Server to end users:

  • OS dependency of the Language Server.
  • Availability of the latest version online.
  • Compatibility with breaking changes between versions.
  • Feasibility of requesting the user to provide the Language Server binary path.

If you encounter any issues or need assistance, please provide feedback by reaching out to us through the #intellij-platform channel in our JetBrains Platform Slack workspace or by submitting an issue in YouTrack.

image description