mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
language_server_protocol.md: Gradle 1.x/2.x, restructure
This commit is contained in:
parent
0ee38e24aa
commit
1bff9d76ac
@ -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. -->
|
<!-- 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)
|
# Language Server Protocol (LSP)
|
||||||
|
|
||||||
<primary-label ref="CommercialIDEs"/>
|
<primary-label ref="CommercialIDEs"/>
|
||||||
|
|
||||||
<link-summary>Language Server Protocol (LSP) support in IntelliJ-based IDEs</link-summary>
|
<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:
|
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.
|
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.
|
The plugin must target [](idea_ultimate.md) version `2023.2` or later.
|
||||||
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 [](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
|
```kotlin
|
||||||
plugins {
|
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.
|
||||||
|
|
||||||
```
|
</tab>
|
||||||
platformType = IU
|
</tabs>
|
||||||
platformVersion = %ijPlatform%
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
```xml
|
||||||
|
|
||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
<!-- ... -->
|
<!-- ... -->
|
||||||
<depends>com.intellij.modules.ultimate</depends>
|
<depends>com.intellij.modules.ultimate</depends>
|
||||||
</idea-plugin>
|
</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.
|
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.
|
> 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>
|
</procedure>
|
||||||
|
|
||||||
### Status Bar Integration
|
### Status Bar Integration
|
||||||
|
|
||||||
<primary-label ref="2024.1"/>
|
<primary-label ref="2024.1"/>
|
||||||
|
|
||||||
A dedicated <control>Language Services</control> status bar widget is available to monitor the status of all LSP servers.
|
A dedicated <control>Language Services</control> status bar widget is available to monitor the status of all LSP servers.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user