Skip to content
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

Java Comment Templates: Template does not load after restart when using git_config variable #180

Open
pbull-oracle opened this issue Jul 27, 2022 · 1 comment

Comments

@pbull-oracle
Copy link

Environment:

  • Red Hat Enterprise Linux Server release 7.4 (Maipo)
  • Eclipse Platform 4.15.0.I20200305-0155
  • Eclipse Java Development Tools 3.18.300.v20200305-0155
  • Git integration for Eclipse 5.7.0.202003110725-r

Steps:

  1. Create a Java project
  2. Go to Window > Preferences > Java > Code Style > Code Templates
  3. Ensure "Automatically add comments for new methods, types, modules, packages and files" is checked
  4. Select "Comments" > "Files", and click "Edit..."
  5. In the Pattern field, insert text: /* myname: ${name:git_config(user.name)} */
  6. Click OK, then Apply and Close
  7. Create a few new classes and check the generated comments
  8. Restart Eclipse
  9. Create a few new classes and check the generated comments
  10. Go to Window > Preferences > Java > Code Style > Code Templates
  11. Select "Comments" > "Files", and observe the contents of the Pattern field
  12. Create a few new classes and observe the generated comments
  13. Go to Window > Preferences > Java > Code Style > Code Templates
  14. Select "Comments" > "Files", and observe the contents of the Pattern field

Expected results:

  • Custom comment template is loaded and applied correctly at steps 7,9,11,12,14

Actual results:

  • Default comment template (instead of custom template) is loaded/applied incorrectly at steps 9,11.
  • Custom comment template is still loaded and applied correctly at steps 7,12,14.

I started noticing this problem somewhere between releases 4.8 and 4.13.

@iloveeclipse
Copy link
Member

iloveeclipse commented Aug 16, 2022

Cool. I can reproduce on 4.25 head and latest nightly egit build.

Looks like creating the preferences page is needed to properly initialize used templates.

This explains why we don't see anything in step 11 but on next time without any preference change the preferences page shows proper content.

@jjohnstn : not sure if it is interesting for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants