How to use graphql-language-service-types - 3 common examples

To help you get started, we’ve selected a few graphql-language-service-types 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-server / src / MessageProcessor.js View on Github external
params.changes.map(async change => {
        if (
          change.type === FileChangeTypeKind.Created ||
          change.type === FileChangeTypeKind.Changed
        ) {
          const uri = change.uri;
          const text: string = readFileSync(new URL(uri).pathname).toString();
          const contents = getQueryAndRange(text, uri);

          this._updateFragmentDefinition(uri, contents);
          this._updateObjectTypeDefinition(uri, contents);

          const diagnostics = (await Promise.all(
            contents.map(async ({ query, range }) => {
              const results = await this._languageService.getDiagnostics(
                query,
                uri
              );
              if (results && results.length > 0) {
                return processDiagnosticsMessage(results, query, range);
github graphql / graphiql / packages / graphql-language-service-server / src / MessageProcessor.js View on Github external
params.changes.map(async change => {
        if (
          change.type === FileChangeTypeKind.Created ||
          change.type === FileChangeTypeKind.Changed
        ) {
          const uri = change.uri;
          const text: string = readFileSync(new URL(uri).pathname).toString();
          const contents = getQueryAndRange(text, uri);

          this._updateFragmentDefinition(uri, contents);
          this._updateObjectTypeDefinition(uri, contents);

          const diagnostics = (await Promise.all(
            contents.map(async ({ query, range }) => {
              const results = await this._languageService.getDiagnostics(
                query,
                uri
              );
              if (results && results.length > 0) {
github graphql / graphiql / packages / graphql-language-service-server / src / MessageProcessor.js View on Github external
})
          )).reduce((left, right) => left.concat(right));

          this._logger.log(
            JSON.stringify({
              type: 'usage',
              messageType: 'workspace/didChangeWatchedFiles',
              projectName: this._graphQLCache
                .getGraphQLConfig()
                .getProjectNameForFile(uri),
              fileName: uri,
            })
          );

          return { uri, diagnostics };
        } else if (change.type === FileChangeTypeKind.Deleted) {
          this._graphQLCache.updateFragmentDefinitionCache(
            this._graphQLCache.getGraphQLConfig().configDir,
            change.uri,
            false
          );
          this._graphQLCache.updateObjectTypeDefinitionCache(
            this._graphQLCache.getGraphQLConfig().configDir,
            change.uri,
            false
          );
        }
      })
    );

graphql-language-service-types

Types for building GraphQL language services for IDEs

MIT
Latest version published 3 years ago

Package Health Score

61 / 100
Full package analysis