Skip to content

Commit

Permalink
Do not decorate tabs for BUILD files in non-bazel projects (#6925)
Browse files Browse the repository at this point in the history
If a project isn't imported then do not try to decorate
as otherwise tab name has a full path to file.
  • Loading branch information
ujohnny authored Oct 23, 2024
1 parent 3e5835d commit 665b54e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.idea.blaze.base.lang.buildfile.psi.BuildFile;
import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.blaze.base.settings.BlazeImportSettings.ProjectType;
import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand All @@ -15,6 +16,10 @@ private static boolean requiresDecoration(Project project, String fileName) {
@Override
public @Nullable String getEditorTabTitle(@NotNull Project project,
@NotNull VirtualFile virtualFile) {
if (Blaze.getProjectType(project) == ProjectType.UNKNOWN) {
return null;
}

var fileName = virtualFile.getName();
if (!requiresDecoration(project, fileName)) {
return null;
Expand Down

0 comments on commit 665b54e

Please sign in to comment.