Skip to content

Commit

Permalink
handling for rules that involve transitions (#6605)
Browse files Browse the repository at this point in the history
  • Loading branch information
andponlin-canva committed Aug 8, 2024
1 parent 6aa0ee4 commit 321f132
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion base/src/com/google/idea/blaze/base/model/primitives/Kind.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 321f132

Please sign in to comment.