How to get to know about developer code blame in android studio
Asked Answered
M

4

41

I am working on project which is shared by few developers, how to get to know about developer blame in android studio?? any shortcuts or any idea? which will help us to know about code blame.

Madonna answered 3/4, 2017 at 9:17 Comment(0)
I
109

Use Annotate feature of Android Studio

1.Right click in line number pane

enter image description here:

2.Select Annotate

enter image description here

Intensifier answered 3/4, 2017 at 9:21 Comment(10)
Ya this is a feature of android studio I was looking for thanks @rcde0.Madonna
Any idea what to do if this stops working for some unknown reason? The project is setup fine with VCS and integrated correctly (can show history/commit/etc) but the Annotate is greyed-out. Disclaimer: it was working fine until two days ago so i really have no clue what went wrong.Windbag
@Shark, have a look at this answer .Intensifier
Thanks but I fixed it last week.Windbag
can we view this the a Intellij IDEA shows it (like a comment after every line of code)Undertook
Tell Rishi to use string resources! Classic Rishi.Jephthah
Is there a keyboard shortcut to show/hide this?Housetop
@Housetop - never used that, this might help : developer.android.com/studio/intro/…Intensifier
@Intensifier Thanks, that's a very useful link! But I had already figured it out and posted the keyboard-shortcut solution below. https://mcmap.net/q/386003/-how-to-get-to-know-about-developer-code-blame-in-android-studioHousetop
@Housetop Awesome, and my bad, did not see that earlier.Intensifier
M
1

You can install GitToolBox plugin to view code blame on every cursor position.

OR

you can view by right clicking on left gutter in android studio, you will have a pop-up with option for Annotation or Annotate with Git Blame.

Metaphysical answered 30/10, 2021 at 9:47 Comment(0)
H
1

In addition to rcde0's answer, which I use all the time. You can also add a keyboard shortcut to toggle this view.

  1. Preferences -> Keymap to bring up this screen: enter image description here

  2. Type "annotate" in the search area. This will find all commands that refer to the word in the search box.

  3. Click on Git->Git->Annotate, this will bring up the first popup, asking how to proceed.

  4. Select "Add Keyboard Shortcut" like I did here:

enter image description here

  1. Another modal window will pop up, asking you to type in a keyboard shortcut. Select the area I'm pointing to and simply type your keyboard shortcut. You can see that I typed ctrlA. I never use it to jump to the beginning of the line, so this works well for me. enter image description here

  2. If the keystroke is already defined, it will warn you. Feel free to try other keystrokes until you find one that suits your style without eliminating something that you use for other things. Click OK to reassign the keystroke.

  3. You'll now see your new keystroke mapped to the various "Annotate" functions. Hit 'OK' to exit preferences.

  4. Try it out. Type your newly-defined keystroke and see the Annotations in the left gutter toggle on and off.

Housetop answered 14/1, 2022 at 1:52 Comment(0)
M
1

Like me, if someone finds annotation for each line overwhelming and would like a summary for a class and functions, you could enable "Code author" option from Settings -> Inlay Hints -> Code vision -> Code author.

enter image description here

Monkshood answered 5/6 at 16:4 Comment(1)
Perfect Answer, it appears after restart android studio! Thank You.Camphene

© 2022 - 2024 — McMap. All rights reserved.