How to use the graphql-language-service-interface/dist/autocompleteUtils.forEachState function in graphql-language-service-interface

To help you get started, we’ve selected a few graphql-language-service-interface examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mayank1791989 / gql / src / query / _shared / getTypeInfo.js View on Github external
schema: GQLSchema,
  tokenState: TokenState,
): Info {
  const info: Info = {
    type: null,
    parentType: null,
    inputType: null,
    directiveDef: null,
    fieldDef: null,
    argDef: null,
    argDefs: null,
    objectFieldDefs: null,
    objectFieldDef: null,
  };

  forEachState(tokenState, (state) => { // eslint-disable-line complexity
    switch (state.kind) {
      case 'Query':
      case 'ShortQuery':
        info.type = schema.getQueryType();
        break;
      case 'Mutation':
        info.type = schema.getMutationType();
        break;
      case 'Subscription':
        info.type = schema.getSubscriptionType();
        break;
      case 'InlineFragment':
      case 'FragmentDefinition':
        if (state.type) {
          info.type = schema.getType(state.type);
        }
github Mayank1791989 / gql / src / gql-shared / TokenTypeInfo.js View on Github external
constructor(context: TypeInfoContext, tokenState: TokenState) {
    forEachState(tokenState, state => {
      switch (state.kind) {
        case 'Query':
        case 'ShortQuery':
          this._type = context.getQueryType();
          break;
        case 'Mutation':
          this._type = context.getMutationType();
          break;
        case 'Subscription':
          this._type = context.getSubscriptionType();
          break;
        case 'InlineFragment':
        case 'FragmentDefinition': {
          const outputType: mixed = state.type
            ? context.getType(state.type)
            : getNamedType(this.getType());