Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Sep 11, 2025

This pull request implements the following changes:

  • Enables the SQL annotation conversion action to be invoked from DAO methods, not only from SQL files.
  • Adds Java and Kotlin files as targets for displaying the conversion action.
  • After converting from annotation to SQL file, prevents the generated SQL file from being automatically opened.

These changes allow bi-directional conversion between SQL files and annotations directly from DAO methods, improving usability and workflow efficiency.

@xterao xterao self-assigned this Sep 11, 2025
@xterao xterao requested a review from Copilot September 11, 2025 06:33
@xterao xterao merged commit 26dc021 into main Sep 11, 2025
5 checks passed
@xterao xterao deleted the feature/sql-annotation-sqlfile-generation-action-per-class branch September 11, 2025 06:34
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 enables bi-directional SQL annotation conversion by allowing the conversion action to be triggered from DAO methods in Java/Kotlin files in addition to SQL files, and prevents automatic opening of generated SQL files to improve workflow efficiency.

  • Extends SQL file to annotation conversion to work from Java/Kotlin DAO methods
  • Adds Java language support for the ConvertSqlFileToAnnotationAction intention
  • Modifies SQL file generation to prevent automatic opening of created files

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
plugin.xml Registers ConvertSqlFileToAnnotationAction for Java language
ConvertSqlFileToAnnotationAction.kt Adds support for triggering conversion from Java/Kotlin DAO methods
ConvertSqlAnnotationToFileAction.kt Refactors to use shared helper methods and improves condition checking
SqlAnnotationConverter.kt Moves supported types to companion object and adds file opening control
PsiDaoMethod.kt Adds optional parameter to control file opening after SQL generation
ConvertSqlActionTest.kt New base test class with shared test utilities
ConvertSqlFileToAnnotationActionTest.kt Refactored to use base class and improved test assertions
ConvertSqlAnnotationToFileActionTest.kt Refactored to use base class and updated file opening expectations
DaoClass.kt Uses DomaClassName enum for consistency
DomaClassName.kt Adds DAO class name constant

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


val daoClass = findDaoClass("$sqlConversionPackage.$daoName")
myFixture.configureFromExistingVirtualFile(daoClass.containingFile.virtualFile)
println("convertActionName: $convertActionName")
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

Debug print statement should be removed from production test code. Use proper logging or remove this line entirely.

Suggested change
println("convertActionName: $convertActionName")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent Opening Generated SQL Files During Conversion Enable Conversion from SQL Files to @Sql Annotations on DAO Methods

2 participants