9
9
10
10
import com .google .common .collect .Sets ;
11
11
import com .intellij .ide .util .PropertiesComponent ;
12
- import com .intellij .lang .javascript .psi .JSExpression ;
13
12
import com .intellij .lang .javascript .psi .JSFile ;
14
13
import com .intellij .lang .javascript .psi .JSReferenceExpression ;
15
14
import com .intellij .lang .javascript .psi .ecma6 .JSStringTemplateExpression ;
@@ -43,7 +42,6 @@ public class JSGraphQLLanguageInjectionUtil {
43
42
44
43
45
44
public static final String GRAPHQL_ENVIRONMENT = "graphql" ;
46
- public static final String GRAPHQL_TEMPLATE_ENVIRONMENT = "graphql-template" ;
47
45
public static final String RELAY_ENVIRONMENT = "relay" ;
48
46
public static final String APOLLO_ENVIRONMENT = "apollo" ;
49
47
public static final String LOKKA_ENVIRONMENT = "lokka" ;
@@ -95,14 +93,8 @@ public static boolean isJSGraphQLLanguageInjectionTarget(PsiElement host, @Nulla
95
93
tagExpression = (JSReferenceExpression ) template .getPrevSibling ();
96
94
}
97
95
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 )) {
106
98
if (envRef != null ) {
107
99
envRef .set (getEnvironmentFromTemplateTag (tagText , host ));
108
100
}
@@ -118,13 +110,6 @@ public static String getEnvironmentFromTemplateTag(String tagText, PsiElement ho
118
110
return RELAY_ENVIRONMENT ;
119
111
}
120
112
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
- }
128
113
return GRAPHQL_ENVIRONMENT ;
129
114
}
130
115
if (GQL_TEMPLATE_TAG .equals (tagText )) {
0 commit comments