Skip to content

Commit 200d523

Browse files
committed
fix return null instead of empty contents
1 parent 03171d5 commit 200d523

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/graphql-language-service-server/src/MessageProcessor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ export class MessageProcessor {
658658
params: TextDocumentPositionParams,
659659
): Promise<Hover> {
660660
if (!this._isInitialized) {
661-
return { contents: [] };
661+
return null;
662662
}
663663

664664
this.validateDocumentAndPosition(params);
@@ -667,7 +667,7 @@ export class MessageProcessor {
667667

668668
const cachedDocument = this._getCachedDocument(textDocument.uri);
669669
if (!cachedDocument) {
670-
return { contents: [] };
670+
return null;
671671
}
672672

673673
const found = cachedDocument.contents.find(content => {
@@ -679,7 +679,7 @@ export class MessageProcessor {
679679

680680
// If there is no GraphQL query in this file, return an empty result.
681681
if (!found) {
682-
return { contents: [] };
682+
return null;
683683
}
684684

685685
const { query, range } = found;

packages/graphql-language-service-server/src/__tests__/MessageProcessor.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ describe('MessageProcessor', () => {
553553
messageProcessor._getCachedDocument = (_uri: string) => null;
554554

555555
const result = await messageProcessor.handleHoverRequest(test);
556-
expect(result).toEqual({ contents: [] });
556+
expect(result).toBeNull();
557557
});
558558
it('handles provided config', async () => {
559559
const msgProcessor = new MessageProcessor({

0 commit comments

Comments
 (0)