Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Apr 17, 2025

Enables you to jump from a bind variable symbol to its definition by using Ctrl+click.
The target is Dao method argument parameters, class properties, and static property call classes.

@xterao xterao self-assigned this Apr 17, 2025
@xterao xterao added the enhancement New feature or request label Apr 17, 2025
@xterao xterao added this to the 0.6.0 Release milestone Apr 17, 2025
@xterao xterao linked an issue Apr 17, 2025 that may be closed by this pull request
@xterao xterao requested a review from Copilot April 18, 2025 07:10
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 PR introduces a reference jump feature for SQL symbols in the IntelliJ plugin, enabling Ctrl+click functionality from SQL bind variables to their corresponding definitions in DAO methods, class properties, or static fields. Key changes include a method renaming in the test suite, various updates to reference provider implementations to use new language constructs (e.g. SqlElIdExpr instead of SqlElPrimaryExpr), and adjustments in completion and inspection logic based on improved type checking.

Reviewed Changes

Copilot reviewed 31 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/test/kotlin/org/domaframework/doma/intellij/DomaSqlTest.kt Renamed test resource addition method to clarify intent
src/main/kotlin/org/domaframework/doma/intellij/reference/* Updated reference provider implementations to use new identifier types and improved parent lookup logic
src/main/kotlin/org/domaframework/doma/intellij/inspection/* Adjusted inspection logic to filter out false-positive cases using new element type checks
src/main/kotlin/org/domaframework/doma/intellij/contributor/sql/* Refined SQL completion and jump-to-declaration logic using updated language constructs and patterns
src/main/java/org/domaframework/doma/intellij/psi/* Introduced or updated classes for custom SQL expressions, ensuring proper reference resolution
Files not reviewed (2)
  • src/main/java/org/domaframework/doma/intellij/Sql.bnf: Language not supported
  • src/main/resources/META-INF/plugin.xml: Language not supported
Comments suppressed due to low confidence (3)

src/test/kotlin/org/domaframework/doma/intellij/DomaSqlTest.kt:151

  • The method rename from 'addResourceFile' to 'addResourceEmptyFile' improves clarity; please verify that all test invocations are updated accordingly to avoid mismatches.
fun addResourceEmptyFile(vararg sqlFileNames: String) {

src/main/kotlin/org/domaframework/doma/intellij/action/sql/JumpToDeclarationFromSqlAction.kt:167

  • Using PsiTreeUtil to retrieve the parent of a static element enhances robustness; please ensure that the source variable (staticDirection) is consistently defined and that the intended element is always targeted.
val classParent = PsiTreeUtil.getParentOfType(staticDirection, SqlElClass::class.java)

src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/inspector/DaoMethodVariableInspector.kt:100

  • The updated condition relies on checking the elementType instead of an instanceof check; confirm that this condition accurately identifies all relevant identifier cases without inadvertently filtering out valid references.
if (element.elementType == SqlTypes.EL_IDENTIFIER && element.prevSibling?.elementType != SqlTypes.DOT) {

@xterao xterao merged commit 9d13c47 into main Apr 21, 2025
5 checks passed
@xterao xterao deleted the feature/sql-symbol-reference branch April 21, 2025 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable "Jump to Declaration" Action via Ctrl+Click

2 participants