diff --git a/base/src/com/google/idea/blaze/base/model/primitives/Kind.java b/base/src/com/google/idea/blaze/base/model/primitives/Kind.java index cfb99d89e7d..ba07c259665 100644 --- a/base/src/com/google/idea/blaze/base/model/primitives/Kind.java +++ b/base/src/com/google/idea/blaze/base/model/primitives/Kind.java @@ -44,6 +44,13 @@ @AutoValue public abstract class Kind { + /** + * When a rule has a transition applied to it then it will present with this + * prefix on it. + */ + + private final static String RULE_NAME_PREFIX_TRANSITION = "_transition_"; + /** * Provides a set of recognized blaze rule names. Individual language-specific sub-plugins can use * this EP to register rule types relevant to that language. @@ -134,7 +141,13 @@ public static Kind fromProto(IntellijIdeInfo.TargetIdeInfo proto) { @Nullable public static Kind fromRuleName(String ruleName) { - return ApplicationState.getService().stringToKind.get(ruleName); + if (null != ruleName) { + if (ruleName.startsWith(RULE_NAME_PREFIX_TRANSITION)) { + ruleName = ruleName.substring(RULE_NAME_PREFIX_TRANSITION.length()); + } + return ApplicationState.getService().stringToKind.get(ruleName); + } + return null; } /**