Registry

From JetBrains/intellij-community · View interactive version

Registry is an AI agent skill from the GitHub repository JetBrains/intellij-community. Use the IntelliJ Registry API for registry keys and feature flags.

How to use this skill

Skill file

Working with Registry

Documentation

Quick Reference

Defining a Registry Key

Always prefer declaring in plugin.xml (not registry.properties):

<registryKey key="my.feature.enabled"
             defaultValue="true"
             description="Enables my feature"
             restartRequired="false"/>

To override the default value in a dependent plugin, repeat the declaration with the new defaultValue and add overrides="true".

Accessing the Registry

In suspending code:

val isEnabled = RegistryManager.getInstanceAsync().get("my.key")

In blocking code:

val isEnabled = RegistryManager.getInstance().get("my.key")

Access via Registry.get() or Registry.is() is effectively deprecated, since it might cause problems during early IDE startup.

Always prefer the RegistryManager when possible.

Early Startup: Registry.is() with Default Value

When code may run before COMPONENTS_LOADED state (e.g., during EULA dialog, splash screen),

you MUST use Registry.is(key, defaultValue) with an explicit default:

Registry.`is`("my.key", false)  // default must match registry.properties

How to find the default value:

  1. Search in community/platform/util/resources/misc/registry.properties
  2. Or check the <registryKey> declaration in plugin.xml

Why: Registry.is(key) without default logs an error or throws an exception if called before

LoadingState.COMPONENTS_LOADED. The safe overload returns the provided default

when Registry is not yet initialized.

Override via Command Line

For testing or run configurations:

-Dmy.registry.key=value

Registry in Tests

Use the @RegistryKey(key = "my.registry.key", value = "true") annotation on the test method instead of Registry.get().setValue().

See writing-tests for more test patterns.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.