gerrit-intellij-plugin icon indicating copy to clipboard operation
gerrit-intellij-plugin copied to clipboard

Edit a file while being able to see the comments

Open salmon-charles opened this issue 8 years ago • 8 comments

Hello,

Is there a way to checkout a gerrit patch and to work on changed file (ie edit them) while being able to see the comments ?

The flow I was thinking of:

  1. Select your gerrit change
  2. Right-click, checkout
  3. In the file list, select a file; right click "Show diff with Local"
  4. File content are identical, but right content should contain the gerrit comment (as for "Show diff") ? => this way, I can work on my code (left window) while being able to read comments (right window) OR even better
  5. Right click "Edit Source" => open an editable source with gerrit comments inside

Do I miss something or is it a missing feature ? How should I handle these use case ?

Thanks

salmon-charles avatar Oct 19 '16 08:10 salmon-charles

@salmon-charles: This feature does not exist yet. You can see comments in the diff view which you can open when you select a change in the list and the select the file in the panel on the right side.

uwolfer avatar Oct 19 '16 17:10 uwolfer

Hey! If no one minds, I'll try to implement this feature.

The plugin provides "Show Diff with local" view. My idea is to see the comments on the left side. On the right side, the user will be able to edit code accordingly inside the same window.

What do you think?

I'll try to implement navigation between comments as well.

DmitriyKartashov avatar Feb 18 '17 10:02 DmitriyKartashov

@DmitriyKartashov: That would be nice! If have have any questions, please just ask.

uwolfer avatar Feb 18 '17 10:02 uwolfer

I often review code using git review -N <change-id> or with this newly discovered plugin (THANK YOU SO MUCH @uwolfer!) by using "Cherry-Pick (No Commit" so that I can use all the IDE features to analyze the the code, see errors, find references, etc. Since the IDE also shows me the changed portions conveniently in the gutter I never had a problem identifying what has changed.

My input on "editing and commenting at the same time": Does it make sense to be able to comment from the code editor directly? Or at least open the diff view with the position under your cursor in the Gerrit diff view? That would allow you to use all the bells and whistles from the IDE while still allowing you to add comments comfortably. Ideally, the gutter of the general editor would also show an icon in the gutter for each comment.

Having cherry-picked multiple patches makes the mapping from source to the matching Gerrit patch more difficult, of course. If you like this general idea, I am happy to brainstorm a few ideas how that could work.

HBehrens avatar Apr 28 '17 18:04 HBehrens

@HBehrens: Thanks for you comment. IMHO this is a part which definitely could be improved.

Of course we could try to implement it ourselves, but this could be quite hard I guess because there are not APIs for everything. If you see something in IntelliJ (base functionality or another plugin) which is implemented already in a similar way, it's probably easier to implement.

Some time ago, I have talked with a JetBrains developer about some general review APIs for the IntelliJ platform which could be used by all the code review plugins (e.g. also JetBrain's own Upsource). You can find the feature request here: https://youtrack.jetbrains.com/issue/IDEA-138302 (feel free to vote for it).

Btw, @DmitriyKartashov: please post any news here if you had time to look into it.

uwolfer avatar Apr 28 '17 18:04 uwolfer

Thanks for the reply, @uwolfer – I upvoted that ticket but looking at its history makes me sad…

The closest feature I can think of is "Open on GitHub" from the editor's context menu. This could lead to a feature, where one can open the Gerrit review Diff for the same location your cursor was on (remaining problem is to find the correct Gerrit Patch – I personally oftentimes have to deal with several patches at once :( )

HBehrens avatar Apr 28 '17 19:04 HBehrens

I do not see a way to see comments in diff view in GoLand 2019.2.5 and Gerrit plugin 1.2.1-146. I do see selection by yellow and what line the comment is in, but no text for comment. Is that something missing, or are comment texts not fetched?

saurabhaditya avatar Apr 22 '20 17:04 saurabhaditya

For anyone else who has the same issue as @saurabhaditya, you have to hover over the paragraph symbol next to the line number for the comment to appear. It takes a second or so for the pop-up to appear so took me a while to figure this out!

outdooracorn avatar May 09 '22 11:05 outdooracorn