Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
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) {
})
)).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
);
}
})
);