Skip to content

Commit

Permalink
Fix document pre-caching in vscode-graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
wenchienchen-asana committed Feb 3, 2025
1 parent d217a65 commit e150f2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,10 @@ export class MessageProcessor {
const uri = URI.file(filePath).toString();

// I would use the already existing graphql-config AST, but there are a few reasons we can't yet
const contents = await this._parser(document.rawSDL, uri);
const contents = await this._parser(
await readFile(filePath, 'utf-8'),
uri,
);
if (!contents[0]?.query) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ describe('MessageProcessor with config', () => {
);
expect(project.lsp._logger.error).not.toHaveBeenCalled();
expect(await project.lsp._graphQLCache.getSchema('default')).toBeDefined();
// TODO: for some reason the cache result formats the graphql query??
const docCache = project.lsp._textDocumentCache;
expect(
docCache.get(project.uri('query.graphql'))!.contents[0].query,
Expand Down Expand Up @@ -218,8 +217,8 @@ describe('MessageProcessor with config', () => {
character: 0,
},
end: {
line: 2,
character: 1,
line: 0,
character: 25,
},
});

Expand Down

0 comments on commit e150f2c

Please sign in to comment.