From d9167c5c7958ba4bfaffd64b0d5b838ef2772907 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Thu, 11 Aug 2022 13:41:14 +0200 Subject: [PATCH] clarify or emphasize extension identifiers uniqueness --- topics/basics/basic_action_system.md | 3 ++- topics/basics/indexing_and_psi_stubs/file_based_indexes.md | 2 ++ topics/basics/plugin_structure/plugin_extensions.md | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/topics/basics/basic_action_system.md b/topics/basics/basic_action_system.md index ff5423781..6c532635f 100644 --- a/topics/basics/basic_action_system.md +++ b/topics/basics/basic_action_system.md @@ -111,7 +111,8 @@ An example of inspecting PSI elements is demonstrated in the SDK code sample `ac ### Action IDs Every action and action group has a unique identifier. -Basing the identifier for a custom action on the FQN of the implementation is the best practice, assuming the package incorporates the `` of the plugin. +Basing the identifier for a custom action on the fully qualified name of the implementation is the best practice, assuming the package incorporates the `` of the plugin. +Including the plugin identifier in the action identifier should prevent it from clashing with other plugins' actions. An action must have a unique identifier for each place. It is used in the IDE UI, even though the FQN of the implementation is the same. Definitions of identifiers for the standard IntelliJ Platform actions are in [`IdeActions`](upsource:///platform/ide-core/src/com/intellij/openapi/actionSystem/IdeActions.java). diff --git a/topics/basics/indexing_and_psi_stubs/file_based_indexes.md b/topics/basics/indexing_and_psi_stubs/file_based_indexes.md index fdc60cc7c..63940bba1 100644 --- a/topics/basics/indexing_and_psi_stubs/file_based_indexes.md +++ b/topics/basics/indexing_and_psi_stubs/file_based_indexes.md @@ -39,6 +39,8 @@ An implementation of a file-based index consists of the following main parts: * `getValueExternalizer()` returns the [`DataExternalizer`](upsource:///platform/util/src/com/intellij/util/io/DataExternalizer.java) responsible for storing values in a serialized binary format. * `getInputFilter()` allows restricting the indexing only to a certain set of files. Consider using [`DefaultFileTypeSpecificInputFilter`](upsource:///platform/indexing-api/src/com/intellij/util/indexing/DefaultFileTypeSpecificInputFilter.java). +* `getName()` returns a unique index ID. + Consider using fully qualified index class name to not clash with other plugins defining index with the same ID, e.g., `com.example.myplugin.indexing.MyIndex`. * `getVersion()` returns the version of the index implementation. The index is automatically rebuilt if the current version differs from the version of the index implementation used to build it. diff --git a/topics/basics/plugin_structure/plugin_extensions.md b/topics/basics/plugin_structure/plugin_extensions.md index edebe791f..0cf9c53a6 100644 --- a/topics/basics/plugin_structure/plugin_extensions.md +++ b/topics/basics/plugin_structure/plugin_extensions.md @@ -73,7 +73,7 @@ and one extension to access the `another.plugin.myExtensionPoint` extension poin The following properties are available always: -* `id` - unique ID +* `id` - unique ID. Consider prepending ID with the prefix related to the plugin name or ID to not clash with other plugins defining extensions with the same ID, e.g., `com.example.myplugin.myExtension`. * `order` - allows ordering all defined extensions using `first`, `last` or `before|after [id]` respectively * `os` - allows restricting an extension to given OS, e.g., `os="windows"` registers the extension on Windows only