Skip to content

Fix (graphql-language-service) Hover for first line#4162

Open
lesleydreyer wants to merge 7 commits intographql:mainfrom
lesleydreyer:hover-fix
Open

Fix (graphql-language-service) Hover for first line#4162
lesleydreyer wants to merge 7 commits intographql:mainfrom
lesleydreyer:hover-fix

Conversation

@lesleydreyer
Copy link
Copy Markdown
Contributor

@lesleydreyer lesleydreyer commented Jan 30, 2026

fix hover for line 1 (0) in graphiql -> monaco-graphiql when hovering the first line

closes #4157 closes #3168

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 30, 2026

⚠️ No Changeset found

Latest commit: d5f8b01

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@lesleydreyer lesleydreyer changed the title Hover Fix WIP Hover Fix Jan 31, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.02%. Comparing base (54ed55c) to head (d5f8b01).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4162      +/-   ##
==========================================
+ Coverage   63.96%   64.02%   +0.05%     
==========================================
  Files          35       35              
  Lines        3086     3091       +5     
  Branches      949      949              
==========================================
+ Hits         1974     1979       +5     
  Misses       1107     1107              
  Partials        5        5              
Files with missing lines Coverage Δ
...l-language-service/src/interface/getDiagnostics.ts 66.21% <100.00%> (+0.93%) ⬆️
...hql-language-service/src/parser/CharacterStream.ts 78.26% <100.00%> (+0.73%) ⬆️
🚀 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.

@lesleydreyer lesleydreyer changed the title WIP Hover Fix Hover Fix Feb 3, 2026
@lesleydreyer lesleydreyer changed the title Hover Fix Fix Hover for first line Feb 3, 2026
@lesleydreyer lesleydreyer changed the title Fix Hover for first line Fix (graphql-language-service) Hover for first line Feb 19, 2026
Copy link
Copy Markdown
Contributor

@trevor-scheer trevor-scheer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @lesleydreyer! At some point I'll have a closer look at this, but I left a couple comments in case you feel like poking around a bit more to get this right. Hopefully I'll have some more helpful comments for you in the near future.

Comment on lines +253 to +254
end: { character: 23, line: -1 },
start: { character: 22, line: -1 },
Copy link
Copy Markdown
Contributor

@trevor-scheer trevor-scheer Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This smells funny, I suspect we need to normalize the off by 1 line number at the LSP/Monaco boundary where the line off by 1 is happening (presumably).

I can spend some more time investigating at some point but there's probably a more comprehensive solution that results in line numbers we'd actually expect here (presumably 0).

// LSP may count from 1, but monaco counts from 0
for (
let i = 0;
location.line === 0 ? i <= location.line : i < location.line;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the comment above, this doesn't feel like the correct place for this fix.

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.

[graphql-language-service] hover broken [language-service] getRange does not work for line 0

2 participants