Open iwb-cgalvarez opened 9 months ago
Hello,
whether all file templates are unavailable or this one alone ?
The statement
${StringUtils.removeAndHump(${FEATURE_NAME.replaceAll("[^\w]", "_")})}Module.kt
reported an error when I reproduced the problem, but I tried fix it in v1.6.7.
Hello,
Thank you for your response. It happens to all the files that use Apache Velocity on the name definition.
I apologize, but this nested ApacheVelocity statement has been consistently causing errors and preventing file creation on my end. Non-nested structures seem to work fine. Please consider using an alternative approach, such as employing a new placeholder. ๐โโ๏ธ
Hello @dengzii,
Thank you for the suggestion. The problem is that placeholders cannot use apache velocity, do they?
This used to work fine before the fix for this issue, so I think the problem is the mapping between the file name using apache velocity between the realChildren
and the fileTemplates
keys in the moduleTemplate json configuration.
I think the mapping is happening between the result of the apache velocity function on the file names under realChildren
against the unprocessed value of the key under fileTemplates
.
To give you an example:
Imagine that we have a the module template definition that I posted in the issue:
${StringUtils.removeAndHump(${FEATURE_NAME.replaceAll("[^\w]", "_")})}Module.kt
This same file name definition is used in the file name under the folder example
in the screenshot of the issue and under one of the keys under fileTemplates
pointing to the file template Example
.
I think in the code, when trying to find which file template you need to use, the program is using the processed value of the file (TestDemoModule.kt
) against the key which is unprocessed (${StringUtils.removeAndHump(${FEATURE_NAME.replaceAll("[^\w]", "_")})}Module.kt
) and they are indeed not equal.
If you are busy, I can try to fix it on my side when I have a bit of time. Would you accept an external pull request?
Hello! Yes, Iโve been quite busy lately. Iโve already considered the points you mentioned. The crucial issue is that the results of running ApacheVelocity statements in unit tests differ from run compile plugin in the IDEA.
This is the code for simulating the parsing of a node tree in unit tests:
If you could help fix with this, I would greatly appreciate it. ๐
First of all, I would like to thank you for your reactivity and for implementing the feature requested in our previous issue.
After updating to the latest version of the plugin
1.6.6
, we noticed that the splitting of the folders based on the folder name generation through apache velocity works fine now (which is the request feature, thank you for that๐) but the files that use apache velocity create now empty files.Steps to reproduce
Given the following file template:
Given the following module template:
When I create a module using the file and module templates and the configuration shown below
I want to see the
Hello, World!
shown in the template but it's empty instead:Please find attached here the file and module templates to reproduce the issue: module_templates_files.zip
Thank you very much in advance and please don't hesitate to ask if you need further clarifications ๐