Skip to content

Add unified jump-to-definition query - #22358

Merged
hvitved merged 2 commits into
mainfrom
hvitved-unified-jump-definitions
Aug 17, 2026
Merged

Add unified jump-to-definition query#22358
hvitved merged 2 commits into
mainfrom
hvitved-unified-jump-definitions

Conversation

@hvitved

@hvitved hvitved commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Unified currently lacks jump-to-definition support in contextual code navigation. This adds a definitions query backed by the existing static name-binding graph so identifier references resolve to their declarations.

The query follows the contextual-query structure used by other languages and limits results to the selected source file. Inline-expectation tests cover local names, inheritance, static members, nested types, and type aliases. Shared declaration naming logic is extracted into a unified test utility and reused by the existing static name-binding test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3aaa555d-064b-443a-bc65-61a1b99dd0ad
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3aaa555d-064b-443a-bc65-61a1b99dd0ad
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Aug 17, 2026
@hvitved
hvitved marked this pull request as ready for review August 17, 2026 07:24
@hvitved
hvitved requested a review from a team as a code owner August 17, 2026 07:24
Copilot AI balanced review requested due to automatic review settings August 17, 2026 07:24

Copilot AI left a comment

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.

Pull request overview

Adds unified jump-to-definition support using the existing static name-binding graph.

Changes:

  • Adds the definitions API and contextual query.
  • Adds Swift inline-expectation coverage.
  • Extracts reusable declaration-naming test utilities.
Show a summary per file
File Description
unified/ql/lib/codeql/Definitions.qll Defines reference-to-declaration resolution.
unified/ql/lib/ide-contextual-queries/definitions.ql Exposes file-scoped jump-to-definition results.
unified/ql/lib/utils/test/TestUtils.qll Shares declaration naming utilities.
unified/ql/test/library-tests/definitions/test.ql Implements the definitions test query.
unified/ql/test/library-tests/definitions/test.swift Covers supported name-binding scenarios.
unified/ql/test/library-tests/definitions/test.expected Records generated expected results.
unified/ql/test/library-tests/static-name-binding/test.ql Reuses the shared test utility.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 6/7 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@hvitved
hvitved requested a review from asgerf August 17, 2026 07:42

@asgerf asgerf left a comment

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.

👍

@hvitved
hvitved merged commit b9f8dee into main Aug 17, 2026
16 of 18 checks passed
@hvitved
hvitved deleted the hvitved-unified-jump-definitions branch August 17, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants