Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling for rules that involve transitions #6605

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading