Skip to content

fix(graphql-language-service): return null instead of empty contents array when hover results are empty #3913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2025

Conversation

joshbode
Copy link
Contributor

@joshbode joshbode commented May 4, 2025

I recently submitted a (rejected) PR in Neovim because LSPs including graphiql and vtsls are returning empty hover `contents` arrays when there is no result, which is almost always the case for graphiql since it would only ever be expected to produce hover results for embedded #graphql query strings.

The effect of this is that graphiql is showing up in the Neovim LSP hover summary every time a hover request is made, even when there are no results, at locations in the code where results from graphiql would never be expected:

image

Since the LSP spec allows a hover request to return `null`, this change is to align with the LSP spec to return an empty result (null) when there are no results instead of an empty contents array.

Thank you for the GraphiQL language server :)

Related PR: yioneko/vtsls#248

Copy link

changeset-bot bot commented May 4, 2025

🦋 Changeset detected

Latest commit: a4b5ab1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
graphql-language-service-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

linux-foundation-easycla bot commented May 4, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: joshbode / name: Josh Bode (6922c10)
  • ✅ login: dimaMachina / name: Dimitri POSTOLOV (a4b5ab1)

@joshbode joshbode changed the title fix return null instead of empty contents array when hover results are empty fix(graphql-language-service): return null instead of empty contents array when hover results are empty May 4, 2025
Copy link

codecov bot commented May 4, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.93%. Comparing base (03171d5) to head (6922c10).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ql-language-service-server/src/MessageProcessor.ts 50.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3913   +/-   ##
=======================================
  Coverage   63.93%   63.93%           
=======================================
  Files          35       35           
  Lines        3086     3086           
  Branches      950      948    -2     
=======================================
  Hits         1973     1973           
  Misses       1108     1108           
  Partials        5        5           
Files with missing lines Coverage Δ
...ql-language-service-server/src/MessageProcessor.ts 89.18% <50.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dimaMachina dimaMachina merged commit 3b5c309 into graphql:main May 4, 2025
1 of 2 checks passed
@acao acao mentioned this pull request May 4, 2025
@joshbode joshbode deleted the empty-hover branch May 4, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants