r-lib / gert

Simple git client for R
https://docs.ropensci.org/gert/
Other
148 stars 31 forks source link

Add RStudio addins #26

Closed pat-s closed 4 years ago

pat-s commented 4 years ago

These can then be bound to custom shortcuts or accessed via the new "command palette" (>= 1.4), making life much easier. Especially for side-effect calls like git push.

Example: https://github.com/pat-s/raddins/commit/bd3017476b79044bdf257d589c5e1fa495151ad2

jeroen commented 4 years ago

Thanks. I'm not very familiar with rstudio addins, can you add a screenshot or something to show what this looks like?

pat-s commented 4 years ago
image

Can (among other ways) be invoked via the new command palette (in RStudio daily builds). Addins can also be bound to hotkeys directly. Addins can be added to package via a inst/rstudio/addins.dcf file which points to a function of the package, see this example.

image
jeroen commented 4 years ago

This is cool, but because rstudio already has a built-in git panel, I'm not sure how much value this adds. What sort of functionality would benefit from an rstudio-addin that is not available from the git panel?

Also we could potentially add a lot of add-ins. How would decide which functions need an add-in?

Maybe this is more suited for a package that builds on gert, than gert itself.

jennybc commented 4 years ago

If indeed add-ins make sense, I could see using them for that set of git things that come up sort of often, but are unsupported by RStudio. For me, that's git pull with rebase, force push, aborting/backing out of a merge, resets, for starters. But yeah I agree with @jeroen such add-ins seem like a better fit for other packages that are more task and user-interface focused.

pat-s commented 4 years ago

This is cool, but because rstudio already has a built-in git panel, I'm not sure how much value this adds. What sort of functionality would benefit from an rstudio-addin that is not available from the git panel?

It is about shortcuts, not about adding git functionality per se into RStudio. The overarching goal of RStudio addins are to bind such as custom shortcuts. The integrated git panel is not really user friendly imo. In additon, making a commit takes 5 mouse clicks

  1. Active git pane
  2. Click on Commit
  3. Stage the file
  4. Highlight the commit message window
  5. Finally click commit

With the addin, one can make a commit with the current selection of staged files with one shortcut (staging is also a shortcut, even pasting the output of gert::git_status() into the R console). I haven't shown the addin for commiting but you can have a look here: https://twitter.com/pjs_228/status/1263891205487841281?s=20

I use addins for staging, commiting and pushing on a daily base. Also it is very common to have shortcuts for git commands in any editor.

Also we could potentially add a lot of add-ins. How would decide which functions need an add-in?

I would start with the common ones

All others could be added on demand. Having this in {gert} right from the start could give the package a kickstart if promoted nicely.

For me, that's git pull with rebase, force push, aborting/backing out of a merge, resets, for starters

Why only focus on complex tasks? It could provide both worlds, addins for starters and devs. However, I would even argue that it should not contain complex opinionated git tasks as addins because such should not be triggered with a shortcut if used occasionally only.

But yeah I agree with @jeroen such add-ins seem like a better fit for other packages that are more task and user-interface focused.

{gert} is a git-client for R, I think {gert} would be a perfect fit for RStudio git addins.

jeroen commented 4 years ago

I had another experience that made me realize I should not commit to maintaining things that I don't really use or understand myself.

I don't want to spend a lot of time reviewing and testing PR's with addins. So for now I am of the opinion that addins would be more suitable for a package that builds on gert, which is maintained by somebody that is more familiar the RStudio IDE than me.