Skip to content

fix(vscode): filter go to definitions by position #4345

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 3 commits into from
May 9, 2025

Conversation

benfdking
Copy link
Contributor

@benfdking benfdking commented May 8, 2025

  • before we were returning the references for a whole file
  • now we filter by the position of the request

@benfdking benfdking force-pushed the fix_fix_returning_multiple_references branch from 59ff122 to 36ebdb0 Compare May 8, 2025 21:19
@benfdking benfdking changed the title DEPENDENT PR: fix returning multiple references fix(vscode): filter go to definitions by position May 8, 2025
@benfdking benfdking force-pushed the fix_fix_returning_multiple_references branch from 36ebdb0 to 268d423 Compare May 8, 2025 21:22
@benfdking benfdking requested a review from Copilot May 8, 2025 21:28
Copy link
Contributor

@Copilot 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 PR fixes the VS Code go-to definitions functionality by filtering references based on the cursor position rather than returning all references in a file. Key changes include:

  • Addition of a new function, filter_references_by_position, to narrow down the references.
  • Unit tests in tests/lsp/test_reference.py to validate the position filtering behavior.
  • Updates to the goto_definition function in sqlmesh/lsp/main.py to use the filtered references.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/lsp/test_reference.py Added tests for the new filtering function and updated imports.
sqlmesh/lsp/reference.py Introduced filter_references_by_position to filter references.
sqlmesh/lsp/main.py Updated goto_definition to leverage the new filtering function.

Used 'with' statement to properly close file handle after reading.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@benfdking benfdking force-pushed the fix_fix_returning_multiple_references branch from 9d5168d to c167676 Compare May 9, 2025 07:50
@benfdking benfdking enabled auto-merge (squash) May 9, 2025 07:50
@benfdking benfdking merged commit d53e787 into main May 9, 2025
23 checks passed
@benfdking benfdking deleted the fix_fix_returning_multiple_references branch May 9, 2025 08:00
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