Sertion / vscode-gitblame

Visual Studio Code Extension - See Git Blame info in status bar.
https://marketplace.visualstudio.com/items/waderyan.gitblame
MIT License
72 stars 31 forks source link

Feat Request: Custmizable delay before activating blame #139

Closed aaravind100 closed 1 year ago

aaravind100 commented 1 year ago

Could we have an option to set a delay before the blame is activated?

Use case: Having enabled inline blame, when sifting through code, the inline blame often lags behind the cursor, This can be jarring as the inline blame is not a subtle color. I can post a video later.

Having a delay can sorta mitigate this, like the cursor has to stay on a line for several 100 ms before the blame would get activated.

Sertion commented 1 year ago

Hey Ajith! Thank you for the feature request.

I think I understand the issue. I currently don't have a lot of time to spend on the extension but I do accept pull requests if you (or anybody else) want to make an attempt at building it.

aaravind100 commented 1 year ago

Hey Albin, I understand.

TS/JS is not my speciality, but I'll try to give it a go :D

aaravind100 commented 1 year ago

@Sertion i got some time to look into the code and test some things. Initial thought was just to wait for few ms and display the line blame. This sorta works partially, but when zipping around, you see a trail of the past blames and this makes it even worse than before 🙃

After thinking it through, a better solution would be have an event handler which captures cursor events (up/down cursor movements) and events which remain unchanged for x ms would triggers the line blame.

Now that i think about it, this is much more complex than adding a delay and may not be worth adding for a minor annoyance.

Do you have something else in mind or maybe give me some pointers?

Sertion commented 1 year ago

@aaravind100 Thanks a lot for having a look.

The entire extension is sort of build around the idea that everything happens "eventually". Perhaps something can be done similar to how the statusbar element is updated and super short Promise.race?

aaravind100 commented 1 year ago

@aaravind100 Thanks a lot for having a look.

The entire extension is sort of build around the idea that everything happens "eventually". Perhaps something can be done similar to how the statusbar element is updated and super short Promise.race?

@Sertion adding a delay in this method kinda a solves the problem.

Before: Before

After adding 200ms delay: After

Would you like me to create a pr for this?

Sertion commented 1 year ago

Impressive! Please do!

aaravind100 commented 1 year ago

@Sertion i've created this (#141) pr

Sertion commented 1 year ago

Merged.

Sertion commented 1 year ago

A new version has been released. It sometimes can take a few hours before it is available for everyone.

Thank you for your time and effort!

aaravind100 commented 1 year ago

Thanks a lot!!