Skip to content

Commit ed512ba

Browse files
committed
Remove Schema IDL warnings in .graphql files since this is the file extension Facebook uses to print schemas in Relay Modern (#85)
1 parent 3d1239d commit ed512ba

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/main/com/intellij/lang/jsgraphql/ide/annotator/JSGraphQLLanguageWarningAnnotator.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.intellij.lang.jsgraphql.JSGraphQLKeywords;
1313
import com.intellij.lang.jsgraphql.JSGraphQLTokenTypes;
1414
import com.intellij.lang.jsgraphql.psi.JSGraphQLElementType;
15-
import com.intellij.lang.jsgraphql.psi.JSGraphQLFile;
1615
import com.intellij.lang.jsgraphql.psi.JSGraphQLPsiElement;
1716
import com.intellij.lang.jsgraphql.schema.psi.JSGraphQLSchemaFile;
1817
import com.intellij.psi.PsiElement;
@@ -21,18 +20,12 @@
2120
import org.jetbrains.annotations.NotNull;
2221

2322
/**
24-
* Warns about using the Schema IDL in regular GraphQL files, and vice versa.
23+
* Warns about using the GraphQL operations in GraphQL IDL files (.graphqls).
2524
*/
2625
public class JSGraphQLLanguageWarningAnnotator {
2726

2827
public Annotation annotate(PsiFile file, @NotNull PsiElement element, @NotNull AnnotationHolder holder) {
29-
if (file instanceof JSGraphQLFile) {
30-
if (element.getNode().getElementType() == JSGraphQLTokenTypes.KEYWORD) {
31-
if (JSGraphQLKeywords.SCHEMA_DEFINITION_KEYWORDS.contains(element.getNode().getText())) {
32-
return holder.createWarningAnnotation(element, "Schema definitions should be written in GraphQL Schema files (.graphqls)");
33-
}
34-
}
35-
} else if (file instanceof JSGraphQLSchemaFile) {
28+
if (file instanceof JSGraphQLSchemaFile) {
3629
if (element.getNode().getElementType() == JSGraphQLTokenTypes.KEYWORD) {
3730
if (JSGraphQLKeywords.GRAPHQL_ROOT_KEYWORDS.contains(element.getNode().getText())) {
3831
JSGraphQLPsiElement parent = PsiTreeUtil.getParentOfType(element, JSGraphQLPsiElement.class);

0 commit comments

Comments
 (0)