diff --git a/base/src/META-INF/blaze-base.xml b/base/src/META-INF/blaze-base.xml
index 620b28d071d..0b662167bf9 100644
--- a/base/src/META-INF/blaze-base.xml
+++ b/base/src/META-INF/blaze-base.xml
@@ -462,6 +462,7 @@
+
diff --git a/base/src/com/google/idea/blaze/base/editor/BazelEditorTabTitleProvider.java b/base/src/com/google/idea/blaze/base/editor/BazelEditorTabTitleProvider.java
new file mode 100644
index 00000000000..6f6e79e117a
--- /dev/null
+++ b/base/src/com/google/idea/blaze/base/editor/BazelEditorTabTitleProvider.java
@@ -0,0 +1,31 @@
+package com.google.idea.blaze.base.editor;
+
+import com.google.idea.blaze.base.lang.buildfile.psi.BuildFile;
+import com.google.idea.blaze.base.settings.Blaze;
+import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class BazelEditorTabTitleProvider implements EditorTabTitleProvider {
+ private static boolean requiresDecoration(Project project, String fileName) {
+ return Blaze.getBuildSystemProvider(project).possibleBuildFileNames().contains(fileName);
+ }
+ @Override
+ public @Nullable String getEditorTabTitle(@NotNull Project project,
+ @NotNull VirtualFile virtualFile) {
+ var fileName = virtualFile.getName();
+ if (!requiresDecoration(project, fileName)) {
+ return null;
+ }
+
+ return BuildFile.getBuildFileString(project, virtualFile.getPath());
+ }
+
+ @Override
+ public @Nullable String getEditorTabTooltipText(@NotNull Project project,
+ @NotNull VirtualFile virtualFile) {
+ return EditorTabTitleProvider.super.getEditorTabTooltipText(project, virtualFile);
+ }
+}