-
Notifications
You must be signed in to change notification settings - Fork 16
Add inline blame (like in VSCode) #66
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
Conversation
add pretty format of the date, like "3 days ago"st3-gitblame/src/blame_inline.py Lines 43 to 48 in 43887f5
This comment was generated by todo based on a
|
add first line of the commit here, butst3-gitblame/src/blame_inline.py Lines 46 to 51 in 43887f5
This comment was generated by todo based on a
|
Thanks for this. I will give it a try and get back to you. Just to answer the two questions:
You could format it with black but it's not essential.
The source files are organised like this so that there is only a single "plugin" in Sublime terms ( |
…line Blame is disabled
@frou AtomicPackageReloader works like a charm, thank you for the suggestion! If you want, I can push another PR explaining how to set up a local development environment for this plugin. |
After trying this some more, the main thing I notice is due to the fact that
Situation (A) is useful and expected. But I don't think the Inline Blame should be shown in situation (B), both because it's distracting, and because it shows incorrect information. For example, in your GIF, it shows me as being the committer of More generally, we can say that that it doesn't make sense to show any blame information while the file has unsaved edits. This already came up with the existing blame modes. Please give my latest commit a try. Basically, whenever the file has unsaved edits, you need to save it to disk before you'll be shown any Inline Blame.
That's alright - I'll do something about that later |
add pretty format of the date, like "3 days ago"st3-gitblame/src/blame_inline.py Lines 75 to 80 in 8702020
This comment was generated by todo based on a
|
I was actually struggling with fixing this behavior, but you did it and looks good. I tried it and noticed that after I save the file the blame doesn't show, but VSCode does show it. And I think the user also expects it to appear after save. So I added another signal and moved common logic to a separate method. |
Ah, good catch. Another improvement might be to detect the string "Not Committed Yet" and suppress the phantom then too. Because the lines in the gutter (the "mini_diff" indicators) are already sufficient. About the colour of the inline blame text... the hex twiddling is fun, but how about instead just going for a variation on blue, like this the rest of this package's UI already does? Something like p.s. Sorry for the todo[bot] misbehaving. The actual purpose of that bot is to turn any todo that is committed on master into its own Issue. |
add pretty format of the date, like "3 days ago"st3-gitblame/src/blame_inline.py Lines 63 to 68 in 36bf31b
This comment was generated by todo based on a
|
Sure
This depends on the purpose. If we want this plugin to mimic VSCodes', then it should always show. But if you insist, the condition is simple enough (I would rather compare with sha equals to zeros). |
Nah, I don't feel strongly about that. I'm happy to merge this (perhaps with some more of the refinements you mentioned in the OP). I don't think I would leave Inline Blame enabled by default though. Because this package already has (AFAIK) thousands of users who are accustomed to the "unobtrusive" mode of operation, and we know how people get angry if the UI of their software changes significantly. Still, all the users can be told about the new feature in the package update message, and encouraged to try it by editing their settings. |
This last commit had me move code around quite a bit. Sorry for the growing diff!
For this I had to duplicate the parser and replace date parts with relative date. This not very pretty, as I rely on My original plan to use
Because clickable URLs inside the phantom should be the same, I moved handle_phantom_button callback into the base class. I tried to keep the naming of href elements style as close to the original as possible. And that's about it, all of my original ideas are implemented. Please feel free to add any final touches. |
Thanks for your work on this. I will probably tweak this (and some other stuff) a bit, and make sure everything still works on ST3, etc. So the new release of the package won't come for a little while. |
Closes #24.
This is basically a rewrite of #27 with a couple of minor changes:
There are also several caveats, some of which were discussed in previous issues and PRs:
get_blame_text
first needs a major rewrite without regex and use-P
flag ofgit blame
(I am willing to contribute here as well)Things I want to improve after the general idea is accepted:
I am open to any discussion and willing to change the names of the variables as maintainers feel more comfortable with. I was not sure about the code style, because I didn't find any guides, but I can reformat as you wish.
PS: because of the file structure of the plugin it was very inconvenient to develop, I had to move code around and restart sublime text. Was this a deliberate decision? Sorry for the rant.