99
1010import com .google .common .collect .Sets ;
1111import com .intellij .ide .util .PropertiesComponent ;
12- import com .intellij .lang .javascript .psi .JSExpression ;
1312import com .intellij .lang .javascript .psi .JSFile ;
1413import com .intellij .lang .javascript .psi .JSReferenceExpression ;
1514import com .intellij .lang .javascript .psi .ecma6 .JSStringTemplateExpression ;
@@ -43,7 +42,6 @@ public class JSGraphQLLanguageInjectionUtil {
4342
4443
4544 public static final String GRAPHQL_ENVIRONMENT = "graphql" ;
46- public static final String GRAPHQL_TEMPLATE_ENVIRONMENT = "graphql-template" ;
4745 public static final String RELAY_ENVIRONMENT = "relay" ;
4846 public static final String APOLLO_ENVIRONMENT = "apollo" ;
4947 public static final String LOKKA_ENVIRONMENT = "lokka" ;
@@ -95,14 +93,8 @@ public static boolean isJSGraphQLLanguageInjectionTarget(PsiElement host, @Nulla
9593 tagExpression = (JSReferenceExpression ) template .getPrevSibling ();
9694 }
9795 if (tagExpression != null ) {
98- String tagText = tagExpression .getText ();
99- boolean isSupportedTag = SUPPORTED_TAG_NAMES .contains (tagText );
100- if (!isSupportedTag && tagExpression .getQualifier () != null && tagExpression .getReferenceNameElement () != null ) {
101- // also allow builder patterns to trigger injection, e.g. 'builder.foo.bar.graphql``'
102- tagText = tagExpression .getReferenceNameElement ().getText ();
103- isSupportedTag = SUPPORTED_TAG_NAMES .contains (tagText );
104- }
105- if (isSupportedTag ) {
96+ final String tagText = tagExpression .getText ();
97+ if (SUPPORTED_TAG_NAMES .contains (tagText )) {
10698 if (envRef != null ) {
10799 envRef .set (getEnvironmentFromTemplateTag (tagText , host ));
108100 }
@@ -118,13 +110,6 @@ public static String getEnvironmentFromTemplateTag(String tagText, PsiElement ho
118110 return RELAY_ENVIRONMENT ;
119111 }
120112 if (GRAPHQL_TEMPLATE_TAG .equals (tagText ) || GRAPHQL_EXPERIMENTAL_TEMPLATE_TAG .equals (tagText )) {
121- if (host instanceof JSStringTemplateExpression ) {
122- final JSExpression [] arguments = ((JSStringTemplateExpression ) host ).getArguments ();
123- if (arguments .length > 0 ) {
124- // one or more placeholders inside the tagged template text, so consider it templated graphql
125- return GRAPHQL_TEMPLATE_ENVIRONMENT ;
126- }
127- }
128113 return GRAPHQL_ENVIRONMENT ;
129114 }
130115 if (GQL_TEMPLATE_TAG .equals (tagText )) {
0 commit comments