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

Support Annotate #117

Closed
hdpoliveira opened this issue Jul 3, 2020 · 14 comments
Closed

Support Annotate #117

hdpoliveira opened this issue Jul 3, 2020 · 14 comments
Assignees

Comments

@hdpoliveira
Copy link
Collaborator

hdpoliveira commented Jul 3, 2020

The request here is similar to what is shown for GitLens in this video: https://youtu.be/YSgDQHyQASk?t=1771

I saw some related work in https://github.com/itanka9/vscode-hg, not sure if it is functional.

@incidentist
Copy link
Collaborator

There is an old PR #56 from @KristjanTammekivi that looks good but needs testing and conflict resolution. On one hand, I use this feature all the time in git and it's great. On the other hand, it's worth thinking of @mrcrowl's point on a different ticket about whether this is "core functionality" or whether it belongs in some hypothetical "MercuriaLens" extension that has all the flashy cutting-edge UI. This particular feature is not a lot of code, and it's all been written already, whereas the API export stuff needed to create other extensions hasn't been written, so I'm okay having it in this extension.

@hdpoliveira
Copy link
Collaborator Author

I filled this separately from the inline annotation because in this issue I was thinking more about having the same view as the native hg annotate (as the YouTube video in the description), with all the file annotations alongside with the file contents.

In my opinion, I think it is ok to have those features in vscode-hg, and I see myself using them.

@KristjanTammekivi
Copy link

Note: if you plan on building on my work, there's a nasty bug in there where it seems to show the wrong commit message (among some other bugs I'm sure). I'll keep my forked repository (in case someone wants to continue the work) until the feature has been implemented here, but I don't use mercurial anymore so I don't intend to finish it myself.

@jtobin321
Copy link

Has this ever been implemented? I would also really love to be able to see annotations in VS code for mercurial. A lot of people at my company use PHP Storm which does this natively, but VS code does not, even with this extension.

@incidentist
Copy link
Collaborator

@jtobin321 Neither of the annotation UIs discussed in this thread have shipped in the extension. We could roll out annotations for the currently-selected line fairly quickly, because most of the work has already been done. A UI of side-by-side annotations for every line would probably take more time. Knowing that there is demand for this is motivating me to at least get the currently-selected-line annotations out the door.

@jtobin321
Copy link

Hey @incidentist thanks for getting back to me. Yes, if you're are able to roll out even just the single line annotations I think that would be super helpful. Of course, being able to see all lines would be great, but I completely understand that would take more time. Let me know if the single line feature gets shipped and thank you again!

@jtobin321
Copy link

Hey @incidentist no rush, but just curious if the single line annotations are going to be implemented. Like I said, this would be super helpful for me in my current workflow. Let me know, thank you!

@Alphare
Copy link

Alphare commented Sep 10, 2021

I've just switched from PyCharm to VsCode and I agree that this would be a very welcome addition. (I am also a Mercurial core dev if you need help for anything.)

@incidentist
Copy link
Collaborator

@Alphare I appreciate the nudge. This is now back on my radar and I hope to work on it soon but I don't have a timeline.

@incidentist incidentist self-assigned this Sep 12, 2021
@incidentist
Copy link
Collaborator

I've started working on this. It's more challenging than expected. Git returns blame lines for every line in a file, even uncommitted lines. annotate does not, so once we have annotated lines, we need to figure out which lines in the editor correspond with which lines of annotate output. Furthermore, git blame has a --contents flag that basically means "annotate the file as if the stuff I'm about to pass you is the working copy" which would let me easily annotate the contents of a dirty editor.
@Alphare do you know of any way to get hg annotate to include uncommitted lines, or to do the equivalent of the --content flag?
Otherwise we can do our own diffing. VSCode has a lot of diffing code but I can't find any of it exposed via API. There are just a lot of edge cases when diffing that I had hoped to leave to hg or vscode.

@Alphare
Copy link

Alphare commented Dec 10, 2021

Thanks for starting this! And for pinging me.

The working copy is internally a changeset like any other, so for your first question you can do hg annotate --rev 'wdir()' FILE, which will annotate all lines including the dirty ones (those will have a + at the end). This seems to have been introduced in Mercurial 3.4, which is pretty ancient.

Regarding the second question (git blame --content equivalent), there is no way of doing so from the command line currently. It's not something that would be too hard to build, but would be limited to new versions of hg with this hypothetical feature.

@incidentist
Copy link
Collaborator

@Alphare Thanks! I made some progress last night, and this will help.

incidentist added a commit to incidentist/vscode-hg that referenced this issue Dec 14, 2021
incidentist added a commit to incidentist/vscode-hg that referenced this issue Dec 14, 2021
incidentist added a commit to incidentist/vscode-hg that referenced this issue Dec 14, 2021
incidentist added a commit to incidentist/vscode-hg that referenced this issue Dec 29, 2021
incidentist added a commit to incidentist/vscode-hg that referenced this issue Dec 29, 2021
incidentist added a commit to incidentist/vscode-hg that referenced this issue Jan 3, 2022
incidentist added a commit to incidentist/vscode-hg that referenced this issue Jan 3, 2022
incidentist added a commit that referenced this issue Jan 8, 2022
@incidentist
Copy link
Collaborator

This has shipped with v1.8.0. A config setting toggles annotate for the currently selected line, and an Hg: Toggle annotations for this file command is in the command palette. The file annotations go away when the file is edited, same as GitLens. I'm going to close this out; if you have requests to tweak this feature, please submit a new issue. Thanks!

@PF4Public
Copy link

There is a funny bug glitch in the implementation of this feature:

simplescreenrecorder.mp4

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

No branches or pull requests

6 participants