Replies: 3 comments 1 reply
-
|
Thanks for the kind words about Copier, I'm glad it's useful for you and offers a pleasant experience! ❤️ I do have a few suggestions for you:
|
Beta Was this translation helpful? Give feedback.
-
|
I think conditional files are relevant, because they then don't end with .py.jinja directly, meaning even the Better Jinja extension won't be able to highlight them as Python+Jinja. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your messages. So I retested different filename scenarios:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Copier community!
We've recently started using Copier, and it's a very well-designed, easy-to-use, and practical tool! So thank you for Copier!
We now have a new challenge that isn't easy to solve. This challenge concerns conditional files such as:
{% if create_example_module %}example_module.py{% endif %}Everything works fine at this level, but unfortunately, when creating a file like this, we lose the syntax highlighting!
For development, we realized that losing syntax highlighting is very problematic! So, it's this syntax highlighting issue that we haven't been able to resolve with this conditional file model, even after various searches.
Then we tested:
{% if create_example_module %}example_module.py{% endif %}.py.jinja, but as the documentation says, it's not a viable solution.So we persevered and tried several possibilities to preserve syntax highlighting.
Since this only affects a few files for now, a temporary solution we found is as follows:
The directory structure was changed so that:
and in the
copier.yamlfile:So this way we have the file
example_module.pycopied with the values from the template process in example_module.py.jinja.Then, if don't want to keep the
example_module.pyfile in the final output, we added a taskrm -fr ....What do you think of this?
Do you have any other ideas (EDI/VSCode plugin, workaround...) that would allow me to preserve both the conditional file template and syntax highlighting if the file is named
{% if create_example_module %}example_module.py{% endif %}?Do you plan to make any improvements to address this syntax highlighting issue with conditional files?
Thank you in advance and see you soon.
Beta Was this translation helpful? Give feedback.
All reactions