language_server_protocol.md: Gradle 1.x/2.x, restructure

This commit is contained in:
Yann Cébron 2024-07-24 12:01:33 +02:00
parent 0ee38e24aa
commit 1bff9d76ac

View File

@ -1,6 +1,7 @@
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Language Server Protocol (LSP)
<primary-label ref="CommercialIDEs"/>
<link-summary>Language Server Protocol (LSP) support in IntelliJ-based IDEs</link-summary>
@ -22,14 +23,45 @@ Therefore, plugins using Language Server integration are not available in Commun
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
## LSP Plugin Setup
To use the LSP API in a third-party plugin based on the [](tools_gradle_intellij_plugin.md), it is required to upgrade the Gradle IntelliJ Plugin to the latest version available.
This plugin will attach the LSP API sources and code documentation to the project.
The plugin must target [](idea_ultimate.md) version `2023.2` or later.
As LSP became available in the 2023.2 EAP7 of IntelliJ-based IDEs, the plugin must target [](idea_ultimate.md) version `2023.2` or later.
### Gradle
Example <path>build.gradle.kts</path> configuration:
<tabs>
<tab title="IntelliJ Platform Gradle Plugin (2.x)">
Relevant <path>build.gradle.kts</path> configuration:
```kotlin
plugins {
id("org.jetbrains.intellij.platform") version "%intellij-platform-gradle-plugin-version%"
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaUltimate("%ijPlatform%")
}
}
```
</tab>
<tab title="Gradle IntelliJ Plugin (1.x)">
Upgrade the Gradle IntelliJ Plugin to the latest version.
It will attach the LSP API sources and code documentation to the project.
Relevant <path>build.gradle.kts</path> configuration:
```kotlin
plugins {
@ -43,22 +75,26 @@ intellij {
}
```
For projects based on the [](plugin_github_template.md), update the Gradle IntelliJ Plugin to the latest version, and amend the <path>gradle.properties</path> file as follows:
For projects based on the [](plugin_github_template.md), update the Gradle IntelliJ Plugin to the latest version,
and amend the values in <path>gradle.properties</path> accordingly.
```
platformType = IU
platformVersion = %ijPlatform%
```
</tab>
</tabs>
The <path>plugin.xml</path> configuration file needs to specify the dependency on the IntelliJ IDEA Ultimate module:
### plugin.xml
The <path>plugin.xml</path> configuration file must specify the dependency on the IntelliJ IDEA Ultimate module:
```xml
<idea-plugin>
<!-- ... -->
<depends>com.intellij.modules.ultimate</depends>
</idea-plugin>
```
### IDE Setup
The LSP API sources are bundled in IntelliJ IDEA Ultimate and can be found within the <path>\$IDEA_INSTALLATION\$/lib/src/src_lsp-openapi.zip</path> archive.
> Due to technical limitations in IDEs before 2024.1, it is necessary to manually attach sources to the IntelliJ IDEA Ultimate dependency.
@ -118,6 +154,7 @@ private class FooLspServerDescriptor(project: Project) : ProjectWideLspServerDes
</procedure>
### Status Bar Integration
<primary-label ref="2024.1"/>
A dedicated <control>Language Services</control> status bar widget is available to monitor the status of all LSP servers.