diff --git a/platform/lang-impl/src/com/intellij/util/indexing/CorruptionMarker.kt b/platform/lang-impl/src/com/intellij/util/indexing/CorruptionMarker.kt
index 2db6ae9229c7..1f58cc8493f2 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/CorruptionMarker.kt
+++ b/platform/lang-impl/src/com/intellij/util/indexing/CorruptionMarker.kt
@@ -16,6 +16,7 @@ import kotlin.io.path.deleteExisting
internal object CorruptionMarker {
private const val CORRUPTION_MARKER_NAME = "corruption.marker"
private const val MARKED_AS_DIRTY_REASON = "Indexes marked as dirty (IDE is expected to be work)"
+ private const val FORCE_REBUILD_REASON = "Indexes were forcibly marked as corrupted"
private const val EXPLICIT_INVALIDATION_REASON = "Explicit index invalidation"
private val corruptionMarker
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ForceIndexRebuildAction.java b/platform/lang-impl/src/com/intellij/util/indexing/ForceIndexRebuildAction.java
new file mode 100644
index 000000000000..453a55b70844
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/util/indexing/ForceIndexRebuildAction.java
@@ -0,0 +1,20 @@
+// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.util.indexing;
+
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.DumbAwareAction;
+import org.jetbrains.annotations.NotNull;
+
+final class ForceIndexRebuildAction extends DumbAwareAction {
+ @Override
+ public void actionPerformed(@NotNull AnActionEvent e) {
+ FileBasedIndexTumbler tumbler = new FileBasedIndexTumbler();
+ tumbler.turnOff();
+ try {
+ CorruptionMarker.requestInvalidation();
+ }
+ finally {
+ tumbler.turnOn();
+ }
+ }
+}
diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties
index 02f4094ce99e..d17be4ba11ae 100644
--- a/platform/platform-resources-en/src/messages/ActionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties
@@ -2483,3 +2483,4 @@ action.RunToolbarPauseAction.text=Pause
action.RunToolbarHotSwapAction.text=HotSwap
action.ForceIndexRescanning.text=Synchronize Indexes
+action.ForceIndexRebuild.text=Rebuild Indexes
diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml
index e0ab3254bb9a..30feb2c02b4b 100644
--- a/platform/platform-resources/src/idea/LangActions.xml
+++ b/platform/platform-resources/src/idea/LangActions.xml
@@ -1592,5 +1592,6 @@
use-shortcut-of="GotoDeclaration" />
+