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

update cache key to include fragments with call expressions (#134)

Changed files
+13 -1
.changeset
packages
graphqlsp
+5
.changeset/beige-worms-joke.md
···
···
+
---
+
'@0no-co/graphqlsp': patch
+
---
+
+
Add fragments to the cache-key when using call-expressions
+8 -1
packages/graphqlsp/src/diagnostics.ts
···
Kind,
OperationDefinitionNode,
parse,
} from 'graphql';
import { LRUCache } from 'lru-cache';
import fnv1a from '@sindresorhus/fnv1a';
···
});
let tsDiagnostics: ts.Diagnostic[] = [];
-
const cacheKey = fnv1a(texts.join('-') + schema.version);
if (cache.has(cacheKey)) {
tsDiagnostics = cache.get(cacheKey)!;
} else {
···
Kind,
OperationDefinitionNode,
parse,
+
print,
} from 'graphql';
import { LRUCache } from 'lru-cache';
import fnv1a from '@sindresorhus/fnv1a';
···
});
let tsDiagnostics: ts.Diagnostic[] = [];
+
const cacheKey = fnv1a(
+
isCallExpression
+
? texts.join('-') +
+
fragments.map(x => print(x)).join('-') +
+
schema.version
+
: texts.join('-') + schema.version
+
);
if (cache.has(cacheKey)) {
tsDiagnostics = cache.get(cacheKey)!;
} else {