Skip to content
프로젝트

소개

런타임에 IntelliJ 플러그인을 작성할 수 있는 IntelliJ 플러그인 ⚡️

개발 도구

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
+1
in 7 days
+2
in 15 days
+2
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Build Status

LivePlugin

Plugin for IntelliJ-based IDEs to create plugins at runtime using Kotlin and Groovy. To install search for "LivePlugin" in IDE Settings -> Plugins -> Marketplace or use the "Install" button on the Plugin Marketplace website.

Table of Contents

Why?

  • Minimal setup — no need to set up a separate project for plugin development
  • Fast feedback loop — plugins are (re)loaded in the same JVM instance as IDE without restart
  • Usable IDE API — LivePlugin has a small API with entry points for common IDE APIs

Examples

Hello world in Groovy:

import static liveplugin.PluginUtil.show
show("Hello world") // Shows balloon notification popup with "Hello world" text

Insert New Line Above action in Kotlin:

import com.intellij.openapi.actionSystem.AnActionEvent
import liveplugin.*

// Action to insert a new line above the current line.
// Based on this post https://martinfowler.com/bliki/InternalReprogrammability.html
// Note that there is also built-in "Start New Line Before Current" action (ctrl+alt+enter).
registerAction(id = "Insert New Line Above", keyStroke = "ctrl alt shift ENTER") { event: AnActionEvent ->
    val project = event.project ?: return@registerAction
    val editor = event.editor ?: return@registerAction
    executeCommand(editor.document, project) { document ->
        val caretModel = editor.caretModel
        val lineStartOffset = document.getLineStartOffset(caretModel.logicalPosition.line)
        document.insertString(lineStartOffset, "\n")
        caretModel.moveToOffset(caretModel.offset + 1)
    }
}
show("Loaded 'Insert New Line Above' action<br/>Use 'ctrl+alt+shift+Enter' to run it")

Getting started

Make sure "hello world" works fine:

  • In the Live Plugins tool window select "hello-world" plugin and click "Run" button to execute the plugin (Run Plugin action with ctrl+shift+L or alt+C, alt+E shortcut). It should display a message.
  • Make a small modification in plugin.groovy/plugin.kts and rerun the plugin. On the second run, the previous version of the plugin will be unloaded before the code is evaluated again.
  • Modify plugin.groovy/plugin.kts file so that it fails to compile/run. You should see an error message in the Run tool window.
  • Note that plugins are just folders with plugin.groovy or plugin.kts scripts as entry points. This means that you can, for example, copy the path to the plugin folder using the Copy Path action (ctrl/cmd+alt+C shortcut).

Try bundled examples:

  • In the Live Plugins tool window click the "Plus" button (Add Plugin action) to add Kotlin or Groovy examples.
  • It might be useful to install Kotlin or Groovy plugin if your IDE supports them.

If something doesn't work or doesn't make sense, please feel free to report an issue. It's ok to report an issue even if it's just a question.

Once your plugin has grown, you can move it to a proper plugin project still using live plugin for reloading and maybe make it a dynamic plugin.

Settings

Take a look at settings in the Live Plugins tool window:

  • Run Plugins on IDE Start — toggle to run all plugins on IDE start (disabled by default).
  • Run Project Specific Plugins — toggle to run all plugins in .live-plugins project directory when the project is opened and unload them when the project is closed.
  • Add LivePlugin and IDE Jars to Project — add jars from LivePlugin and IDE to the current project as a library (see Project Settings -> Modules). Adding unrelated jars to your project is a bit of a hack, but it can be useful for Groovy plugins to get auto-completion and code navigation in the plugin code. Kotlin plugins with a single plugin.kts should have auto-completion and code navigation without it. Multiple Kotlin files are not highlighted at the moment (see this YouTrack issue) but should compile and run.
  • Expose LivePlugin Tools via MCP — turn on MCP tools for AI agents (disabled by default; requires restart). See IDE Settings -> Tools -> MCP Server -> Exposed Tools. The tools include list_live_plugins, run_live_plugin, read_ide_log, etc. See LivePluginToolset for details.
  • IntelliJ Source Code Path for MCP… — path to directory with intellij-community source code (exposed via get_intellij_source_code_path MCP tool), so that agents instead of "remembering" could look up the actual API.

Learn more about IntelliJ API

  • Read (or at least skim) plugin development fundamentals.
  • Explore IntelliJ source code by cloning or browsing it on GitHub. One useful strategy is to search for text you can see in IDE UI and then figure out how it's connected to the code which does the actual work.
  • PluginUtil class and liveplugin package might have some good starting points to explore IntelliJ API.

How does LivePlugin work?

Overall, the idea is just to load and run plugin Groovy or Kotlin classes in the IDE JVM at runtime. More specifically the steps are:

  • if there is an instance of pluginDisposable from previous execution, then dispose it (on EDT)
  • create a new classloader with dependencies on other plugins and jars (on a background thread)
  • compile code if necessary and load classes in the classloader (on a background thread)
  • run the plugin code (on EDT)

This means that plugin code can use any internal IDE API and observe/change IDE state. There are some limitations of course, such as final fields and IDE APIs which are not designed to be re-initialized.

Most IntelliJ-based IDEs come with a bundled Groovy jar which is used for loading and running live plugins (otherwise, the groovy-all jar will be downloaded). LivePlugin uses its own version of Kotlin stdlib and compiler because the version bundled with IDEs changes quite often and seems to be harder to rely on.

Some practical use cases

  • project-specific workflow automation
  • integrating shell scripts with IDE
  • prototyping plugins, experimenting with IntelliJ API

More examples

Similar plugins

The idea of running code inside IntelliJ is not original. There are/were similar plugins:

Contributing

Please see CONTRIBUTING.md.

관련 프로젝트 살펴보기

불러오는 중…