in src/main/com/intellij/lang/jsgraphql/psi/impl/GraphQLArgumentMixin.java [30:70]
public GraphQLType getTypeScope() {
final GraphQLSchema schema = GraphQLSchemaProvider.getInstance(getProject()).getSchemaInfo(this).getSchema();
final String argumentName = getName();
if (argumentName != null) {
// the type scope for an argument is the argument definition type in a field or directive definition
final GraphQLDirective directive = PsiTreeUtil.getParentOfType(this, GraphQLDirective.class);
if (directive != null) {
final String directiveName = directive.getName();
if (directiveName != null) {
final com.intellij.lang.jsgraphql.types.schema.GraphQLDirective schemaDirective = schema.getFirstDirective(directiveName);
if (schemaDirective != null) {
final com.intellij.lang.jsgraphql.types.schema.GraphQLArgument schemaDirectiveArgument =
schemaDirective.getArgument(argumentName);
if (schemaDirectiveArgument != null) {
return schemaDirectiveArgument.getType();
}
}
}
return null;
}
final GraphQLField field = PsiTreeUtil.getParentOfType(this, GraphQLField.class);
final GraphQLTypeScopeProvider typeScopeProvider = PsiTreeUtil.getParentOfType(field, GraphQLTypeScopeProvider.class);
if (field != null && typeScopeProvider != null) {
GraphQLType typeScope = typeScopeProvider.getTypeScope();
if (typeScope != null) {
typeScope = GraphQLSchemaUtil.getUnmodified(typeScope); // unwrap list, non-null since we want a specific field
if (typeScope instanceof GraphQLFieldsContainer) {
final GraphQLFieldDefinition fieldDefinition = ((GraphQLFieldsContainer)typeScope).getFieldDefinition(field.getName());
if (fieldDefinition != null) {
com.intellij.lang.jsgraphql.types.schema.GraphQLArgument argumentDefinition = fieldDefinition.getArgument(argumentName);
if (argumentDefinition != null) {
return argumentDefinition.getType();
}
}
}
}
}
}
return null;
}