Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 31, 2025

  • Merge main branch into PR branch
  • Resolve merge conflicts in hover.go
  • Replace manual range calculation with getRangeOfNode helper
  • Resolve merge conflicts in test baselines
  • Eliminate duplicate getNodeForQuickInfo calls
  • Remove unnecessary comments
  • Reply to comment with results

Summary

Successfully merged main branch and refactored the hover range calculation:

Key changes:

  • Eliminated duplicate getNodeForQuickInfo calls by removing the getQuickInfoAndDocumentation wrapper function
  • ProvideHover now directly calls getQuickInfoAndDocumentationForSymbol with the pre-calculated rangeNode
  • Replaced manual range calculation with l.getRangeOfNode(rangeNode, nil, nil)
  • Removed unnecessary scanner import
  • Adapted to new function signatures (methods on LanguageService with receiver)
  • Removed unnecessary comments - the code is self-documenting

The code now calls getNodeForQuickInfo only once per hover request, improving performance and following the same pattern used in find-all-references and other LSP features.

Fixes #1488


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Return applicable ranges for hover requests Add range field to hover responses for applicable ranges Jul 31, 2025
Copilot AI requested a review from DanielRosenwasser July 31, 2025 08:07
Copilot finished work on behalf of DanielRosenwasser July 31, 2025 08:07
… and remove whitespace from ranges

Co-authored-by: DanielRosenwasser <[email protected]>
Copilot AI changed the title Add range field to hover responses for applicable ranges Fix hover range calculation: eliminate duplicate calls and remove whitespace from ranges Jul 31, 2025
Copilot AI requested a review from DanielRosenwasser July 31, 2025 08:42
Copilot finished work on behalf of DanielRosenwasser July 31, 2025 08:42
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jul 31, 2025

@copilot Fix whatever is broken in CI

@DanielRosenwasser
Copy link
Member

@copilot fix

Copy link
Contributor Author

Copilot AI commented Jul 31, 2025

@copilot Fix whatever is broken in CI

Fixed the CI failures in fb261c4. The test failures were due to outdated baseline files that needed to be updated to reflect the corrected hover range calculations. All tests now pass after accepting the new baselines.

Copy link
Contributor Author

Copilot AI commented Jul 31, 2025

@copilot fix

Fixed in fb261c4 by updating the hover baselines to reflect the corrected range calculations. All tests are now passing.

Copilot finished work on behalf of DanielRosenwasser July 31, 2025 20:24
@jakebailey
Copy link
Member

@copilot Merge main and try again. Note that there now exist helpers that can do things like getting ranges for nodes like getRangeOfNode.

Copy link
Contributor Author

Copilot AI commented Oct 24, 2025

@copilot Merge main and try again. Note that there now exist helpers that can do things like getting ranges for nodes like getRangeOfNode.

Merged main and refactored to use the getRangeOfNode helper in e363a0b. The manual range calculation with scanner.SkipTrivia has been replaced with a call to l.getRangeOfNode(rangeNode, nil, nil), which handles trivia skipping and other edge cases more robustly. The code now follows the same pattern used in find-all-references.

@jakebailey
Copy link
Member

well, copilot doesn't understand how submodules work in merge conflicts either, understandable

Copilot finished work on behalf of jakebailey October 24, 2025 18:09
Copilot AI requested a review from jakebailey October 24, 2025 18:09
Copilot finished work on behalf of jakebailey October 24, 2025 18:57
Copilot AI requested a review from jakebailey October 24, 2025 18:57
Copilot AI requested a review from jakebailey October 24, 2025 19:19
Copilot finished work on behalf of jakebailey October 24, 2025 19:19
@jakebailey jakebailey marked this pull request as ready for review October 24, 2025 19:19
Copilot AI review requested due to automatic review settings October 24, 2025 19:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements a performance improvement and refactoring for the hover range calculation in the Language Server Protocol (LSP) implementation. The primary goal is to eliminate duplicate calls to getNodeForQuickInfo and ensure hover ranges accurately reflect the symbol's extent without including surrounding whitespace.

Key changes:

  • Removed duplicate getNodeForQuickInfo calls by eliminating the getQuickInfoAndDocumentation wrapper function
  • Implemented direct use of getRangeOfNode helper for more accurate range calculation
  • Updated test baselines to reflect the new behavior where hover ranges now include the full identifier/symbol instead of just a single character

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

This is now exactly what I expected this to look like.

@jakebailey jakebailey changed the title Fix hover range calculation: eliminate duplicate calls and remove whitespace from ranges Add Range to Hover Oct 24, 2025
@jakebailey jakebailey enabled auto-merge October 24, 2025 20:53
@jakebailey
Copy link
Member

We are both review poisoned ☹️

@jakebailey jakebailey added this pull request to the merge queue Oct 24, 2025
Merged via the queue into main with commit d461fad Oct 24, 2025
42 checks passed
@jakebailey jakebailey deleted the copilot/fix-1488 branch October 24, 2025 21:56
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.

Return applicable ranges for hover requests

5 participants