Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.

Use gql web visit and print (#172)

* use graphql.web for better visit perf

* also replace print

Changed files
+10 -15
.changeset
packages
+5
.changeset/gentle-poets-notice.md
···
+
---
+
'@0no-co/graphqlsp': patch
+
---
+
+
Use `@0no-co/graphql.web` for better `visit` perf
+1 -1
packages/graphqlsp/src/ast/resolve.ts
···
-
import { print } from 'graphql';
+
import { print } from '@0no-co/graphql.web';
import { ts } from '../ts';
import { findNode } from '.';
import { getSource } from '../ast';
+3 -12
packages/graphqlsp/src/autoComplete.ts
···
CharacterStream,
ContextToken,
} from 'graphql-language-service';
-
import {
-
FragmentDefinitionNode,
-
GraphQLSchema,
-
Kind,
-
parse,
-
print,
-
} from 'graphql';
+
import { FragmentDefinitionNode, GraphQLSchema, Kind, parse } from 'graphql';
+
import { print } from '@0no-co/graphql.web';
import {
bubbleUpCallExpression,
···
fragments = parsed.definitions.filter(
x => x.kind === Kind.FRAGMENT_DEFINITION
) as Array<FragmentDefinitionNode>;
-
} catch (e) {
-
console.log('[GraphQLSP] ', e);
-
}
-
console.log('fraggers', fragments.map(x => print(x)).join('\n'));
+
} catch (e) {}
let suggestions = getAutocompleteSuggestions(schema, queryText, cursor);
let spreadSuggestions = getSuggestionsForFragmentSpread(
···
queryText,
fragments
);
-
console.log(JSON.stringify(spreadSuggestions, null, 2));
const state =
token.state.kind === 'Invalid' ? token.state.prevState : token.state;
+1 -1
packages/graphqlsp/src/diagnostics.ts
···
Kind,
OperationDefinitionNode,
parse,
-
print,
visit,
} from 'graphql';
import { LRUCache } from 'lru-cache';
import fnv1a from '@sindresorhus/fnv1a';
+
import { print } from '@0no-co/graphql.web';
import {
findAllCallExpressions,
-1
packages/graphqlsp/src/index.ts
···
import { getGraphQLQuickInfo } from './quickInfo';
import { getGraphQLDiagnostics } from './diagnostics';
import { templates } from './ast/templates';
-
import { Kind, buildClientSchema, printIntrospectionSchema } from 'graphql';
function createBasicDecorator(info: ts.server.PluginCreateInfo) {
const proxy: ts.LanguageService = Object.create(null);