From 5cd29ec6c074472f5525b2528a22318bbce5eb6d Mon Sep 17 00:00:00 2001 From: Steve Barrau <98589981+stevebarrau@users.noreply.github.com> Date: Tue, 24 Oct 2023 11:39:44 +0100 Subject: [PATCH] fix: Mark package with BUILD.bazel file in completion --- .../base/lang/buildfile/references/FileLookupData.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base/src/com/google/idea/blaze/base/lang/buildfile/references/FileLookupData.java b/base/src/com/google/idea/blaze/base/lang/buildfile/references/FileLookupData.java index 4a8d8908d8b..8714ad71321 100644 --- a/base/src/com/google/idea/blaze/base/lang/buildfile/references/FileLookupData.java +++ b/base/src/com/google/idea/blaze/base/lang/buildfile/references/FileLookupData.java @@ -15,6 +15,7 @@ */ package com.google.idea.blaze.base.lang.buildfile.references; +import com.google.common.collect.ImmutableSet; import com.google.idea.blaze.base.lang.buildfile.completion.FilePathLookupElement; import com.google.idea.blaze.base.lang.buildfile.psi.BuildFile; import com.google.idea.blaze.base.lang.buildfile.psi.StringLiteral; @@ -38,6 +39,7 @@ /** The data relevant to finding file lookups. */ public class FileLookupData { + private static final ImmutableSet BUILDFILE_NAMES = ImmutableSet.of("BUILD", "BUILD.bazel"); /** The type of path string format */ public enum PathFormat { @@ -163,8 +165,10 @@ public FilePathLookupElement lookupElementForFile( new NullableLazyValue() { @Override protected Icon compute() { - if (file.findChild("BUILD") != null) { - return BlazeIcons.BuildFile; + for (String buildfileName : BUILDFILE_NAMES) { + if (file.findChild(buildfileName) != null) { + return BlazeIcons.BuildFile; + } } if (file.isDirectory()) { return PlatformIcons.FOLDER_ICON;