-
Notifications
You must be signed in to change notification settings - Fork 0
Reference custom function definition class from config file #185
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
Conversation
There was a problem hiding this 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 shifts the custom function registration from the plugin settings UI to reading the ExpressionFunctions implementation class from doma.compile.config, aligning with Doma’s one-implementation convention.
- Removed custom-function UI, state and settings handling.
- Added
DomaCompileConfigUtilto loaddoma.expr.functionsfromdoma.compile.config. - Updated references and inspections to use the config value and cleared path caches on refactoring.
Reviewed Changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/messages/DomaToolsBundle.properties | Removed custom-functions keys and renamed related message keys. |
| src/main/kotlin/org/domaframework/doma/intellij/setting/SettingComponent.kt | Dropped custom-function UI components and binding logic. |
| src/main/kotlin/org/domaframework/doma/intellij/reference/SqlElFunctionCallExprReference.kt | Updated function lookup to use config file instead of settings. |
| src/main/kotlin/org/domaframework/doma/intellij/common/config/DomaCompileConfigUtil.kt | New utility to read and cache doma.compile.config entries. |
| README.md | Documented new doma.expr.functions config usage. |
Comments suppressed due to low confidence (3)
README.md:99
- Remove or update this bullet, as the settings screen no longer allows entering custom function classes (it's now driven by
doma.compile.config).
- Specify the class names that define custom functions.
src/main/kotlin/org/domaframework/doma/intellij/reference/SqlElFunctionCallExprReference.kt:66
- [nitpick] Rename
implementsClassto something likefunctionsClassfor clarity, and remove the safe-call operator (?) since the variable is guaranteed non-null.
val methods = implementsClass?.findMethodsByName(variableName, true)?.firstOrNull()
src/main/kotlin/org/domaframework/doma/intellij/common/config/DomaCompileConfigUtil.kt:36
- Add unit tests for
getConfigValueto verify loading, caching behavior, and fallback when the key or file is missing.
fun getConfigValue(
src/main/kotlin/org/domaframework/doma/intellij/common/config/DomaCompileConfigUtil.kt
Outdated
Show resolved
Hide resolved
| holder: ProblemsHolder, | ||
| isOnTheFly: Boolean, | ||
| ): PsiElementVisitor { | ||
| // TODO Support Kotlin Project |
Copilot
AI
May 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either implement Kotlin support for this inspector or create a tracked issue and remove or clarify this TODO.
Co-authored-by: Copilot <[email protected]>
34cd6ab to
a5f1b3a
Compare
52bcad2 to
5e60af6
Compare
Reference custom function definition class from config file
Change the logic that previously referenced the custom function definition based on the
ExpressionFunctionsimplementation class registered in the settings screen so that it now reads the class name from thedoma.compile.configfile at the root of the resources directory.Since Doma assumes one
ExpressionFunctionsimplementation per project, update this behavior to match that convention.Cache the module directory structure and the contents of the config file.
Reimplementation of the following task
#175
#181