How to use the graphql-language-service-interface.getOutline 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 graphql / graphiql / packages / graphql-language-service / src / client.js View on Github external
function _getOutline(queryText: string): EXIT_CODE {
  try {
    const outline = getOutline(queryText);
    if (outline) {
      process.stdout.write(JSON.stringify(outline, null, 2));
    } else {
      throw Error('Error parsing or no outline tree found');
    }
  } catch (error) {
    process.stderr.write(error);
    return GRAPHQL_FAILURE_CODE;
  }
  return GRAPHQL_SUCCESS_CODE;
}
github graphql / graphiql / src / server / MessageProcessor.js View on Github external
const formatted = result.map(
        res => ({
          text: res.label,
          typeName: res.detail ? String(res.detail) : null,
          description: res.documentation || null,
        }),
      );
      responseMsg = convertToRpcMessage({
        type: 'response',
        id,
        formatted,
      });
      process.stdout.write(JSON.stringify(responseMsg) + '\n');
      break;
    case 'getOutline':
      result = getOutline(query);
      responseMsg = convertToRpcMessage({
        type: 'response',
        id,
        result,
      });
      process.stdout.write(JSON.stringify(responseMsg) + '\n');
      break;
    default:
      break;
  }
}