GoLand Plugin Development
Edit page Last modified: 29 九月 2022GoLand is an IntelliJ Platform-based product. Plugin projects for GoLand can be developed using IntelliJ IDEA with the Gradle IntelliJ Plugin.
tip
Qualifying Open Source projects can apply for free licenses of JetBrains products.
Configuring Plugin Projects Targeting GoLand
The configuration of targeting GoLand IDE follows the methods described in Configuring Plugin Projects Using a Product-Specific Attribute.
Starting with 2020.2, it's possible to configure GO
for intellij.type
in the Gradle build script.
intellij {
version.set("2020.3")
type.set("GO")
}
intellij {
version = '2020.3'
type = 'GO'
}
The configuration of GoLand plugin projects follows the methods described in Configuring Plugin Projects using the IntelliJ IDEA Product Attribute, and Configuring the plugin.xml File.
The table below summarizes the Gradle IntelliJ Plugin attributes to set in the plugin project's Gradle build script. Click on an entry in the table's Attribute column to go to the documentation about that attribute. To see how these attributes appear in a similar Gradle build script for PhpStorm, see Configuring Gradle Build Script Using the IntelliJ IDEA Product Attribute.
The Go plugin version is explicitly declared because it isn't bundled with IntelliJ IDEA Ultimate Edition. Select a version of the Go plugin compatible with the IntelliJ Idea Ultimate version.
| Attribute Value |
---|---|
| |
Set to the same | |
See below for Go plugin version information. | |
Path to locally installed target version of GoLand. For example, on macOS: |
The dependency on the Go plugin APIs must be declared in the plugin.xml file. As described in Modules Specific to Functionality table, the <depends>
tags must declare com.intellij.modules.goland
. The plugin.xml file must also declare a dependency on com.intellij.modules.platform
as explained in Configuring the plugin.xml File. The dependency declaration is illustrated in the plugin.xml snippet below:
<!-- Requires the GoLand module -->
<depends>com.intellij.modules.goland</depends>
<!-- Requires the platform module to distinguish it from a legacy plugin -->
<depends>com.intellij.modules.platform</depends>
<!-- Requires the Go module -->
<depends>com.intellij.modules.go</depends>
<!-- Requires the platform module to distinguish it from a legacy plugin -->
<depends>com.intellij.modules.platform</depends>
Targeting IDEs Other Than GoLand
Depending on the com.intellij.modules.goland
allows a plugin to be installed in the GoLand IDE only. However, the Go plugin can be installed in IntelliJ IDEA Ultimate and potentially other IDEs. To make the plugin compatible with GoLand and other IDEs supporting the Go language consider depending on:
org.jetbrains.plugins.go
- The plugin will be loaded only when the Go plugin is actually installed in the running IDE.com.intellij.modules.go-capable
- The plugin will be loaded in IDEs that are capable of installing the Go plugin. Note that the Go plugin doesn't have to be actually installed when this module is present.
Available GoLand APIs
tip
See GoLand Extension Point and Listener List for the complete list.
Use the Exploring APIs as a Consumer process to identify the library intellij-go-$version$.jar, where $version$
corresponds to the version of the Go plugin. Test your plugin with any version of GoLand you intend to support.
GoLand Test Framework
Please see this issue for required additional dependency setup.
Open Source Plugins for GoLand
When learning new APIs, it is helpful to have some representative projects for reference: