annotate_models icon indicating copy to clipboard operation
annotate_models copied to clipboard

Comments get lost when generating annotations

Open cmer opened this issue 3 years ago • 9 comments

When there are already comments above a class definition, AnnotateModels deletes them when regenerating annotations.

Here's a short video showing the issue: https://cln.sh/Iw7NsPk7yEfmkyPWtIim

Version

  • annotate version: 3.2
  • rails version: 5.2.6.2
  • ruby version: 2.7.5

cmer avatar Apr 29 '22 14:04 cmer

running into this as well

joevandyk avatar Jul 05 '22 21:07 joevandyk

It works to add a blank line above the comment before annotating, but you need to find them first (I spotted it accidentally when reviewing a PR).

alexeyr-ci1 avatar Jul 29 '22 12:07 alexeyr-ci1

Yes but obviously nobody remembers to do that on a large team :) On Jul 29, 2022, 8:30 AM -0400, alexeyr-ci1 @.***>, wrote:

It works to add a blank line above the comment before annotating, but you need to find them first (I spotted it accidentally when reviewing a PR). — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

cmer avatar Jul 29 '22 12:07 cmer

Sorry, it's actually worse than I thought. It looked like it worked only because the comment wasn't getting regenerated. If I use --force (or do a schema change which forces a regeneration), then the first time eats the empty line and leaves the comment intact (so really hard to note in code review), and the next time eats the comment 🤣.

alexeyr-ci1 avatar Jul 29 '22 16:07 alexeyr-ci1

Is there a workaround for this?

filipesperandio avatar Jan 22 '24 13:01 filipesperandio

Hey folks, I believe I was able to solve this bug in my gem https://github.com/drwl/annotaterb/pull/72

drwl avatar Feb 17 '24 16:02 drwl

I wasn't aware of the fork. I'll definitely check it out. Thanks!

cmer-sh avatar Feb 17 '24 19:02 cmer-sh