File and Code Templates in 2022.2

Hi, I'm having problems with the templates from my plugin, they were working fine before PhpStorm 2022.2, but now when I go to "File and Code Templates" and try to open them (or just using them from my code) it shows the error "Cannot Save Current Template. Invalid template name or extension" and shows a green background instead of the template.

Also after that I cannot see any other template, I need to reopen the Settings window.

Any clue to solve this? I didn't change anything in my plugin, is something new in PhpStorm 2022 what is making it to fail

 

EDIT: I can solve this bug just editing any other valid template (at least from "Includes" category, no matter if the template is used or not (with #parse for example) in my templates, just editing some valid template and saving it, is bugfixing my templates (which I can see as edited after that, even when I'm not editing them, I'm editing and saving another template).

This seems to be a bug from PhpStorm but I don't know how to report it because I can reproduce it only with my plugin, but I hope someone can guess what could be happening.

 

5 comments
Comment actions Permalink

No idea so far. Do you think you could share the plugin?
If it has sensitive data in it, you can upload it to our storage: https://uploads.services.jetbrains.com/

0
Comment actions Permalink

Yes it's private, do you know some tip to try to debug the error? Maybe some class/method where I can put a brakpoint and see why is that error thrown, and why after saving any other template it seems to be fixed.

PhpStorm is showing all my templates as "edited" after saving another template, it's like if saving another template is executing some fix on my templates too and resaving them, but I don't know what is the problem, they work fine in 2022.1, there's something different in 2022.2

0
Comment actions Permalink

With some help from colleagues, I've manage to find this regression: https://youtrack.jetbrains.com/issue/IDEA-299563/File-and-code-templates-suddenly-fail-if-the-ft-file-has-CRLF-line-endings
If your templates contain Windows line endings, they won't work in 2022.2. You can either wait until IDEA fixes the bug, or re-create the plugin using Linux line endings instead.

0
Comment actions Permalink

Yes I thought that could be a reason so I've tried changing to Linux line endings but didn't work either.

I hope IDEA can fix this soon

0
Comment actions Permalink

You mean, you've rebuilt the plugin with LF line endings, and it still doesn't work?
If so, could you please upload your logs (Help | Collect Logs and Diagnostic Data) here after you open a file template that would have this green background?
You can upload the archive here: https://uploads.services.jetbrains.com/

0

Please sign in to leave a comment.