Giter VIP home page Giter VIP logo

magit-gh-comments's Introduction

magit-gh-comments.el

Disclaimer

This is README is… aspirational. I’m still actively developing this package, and there’s a large gap between what’s advertised here and what has been implemented so far.

Overview

magit-gh-comments is a minor-mode which enables commenting on Github PRs from within Magit.

Dependencies

This package must be used in conjuction with magit-gh-pulls and, of course, magit.

Keybindings

magit-gh-comments defines the following keybindings:

C-c C-p
jump previous comment
C-c C-n
jump to next commment
C
open the magit-gh-comments popup menu

From the popup menu, you may choose to (a)dd, (e)dit, (d)elete, or (r)efresh the comments on the active Github PR.

Usage

PR Comments are automatically loaded and displayed inline in any magit-diff buffer opened from the [Pull Requests] section (see Dependencies).

To post a comment on the line at point, press C a from within a diff buff. Edit the comment at point with C e. C d deletes the comment a point.

Troubleshooting

The function magit-gh-comments-report-bug will prepare an Org file with some diagnostic information about your Emacs environment that you can attach when filing an Issue.

magit-gh-comments's People

Contributors

astahlman avatar

Watchers

 avatar  avatar

magit-gh-comments's Issues

Minibuf should show hints when point is on an editable section

Half-baked idea: when point is on something that can be interacted with (e.g., a comment), show the keybindings and/or actions available. This should be doable by setting the kbd-help text property, i.e.,

(propertize "Some comment" 'kbd-help "[C-c e] Edit \n[C-c d] Delete")

Ability to edit comments

As a user, I want to place point on a comment in a magit-diff buffer and edit the body of the comment.

Pending reviews should be marked as such

The review buffer currently shows pending, top-level, review comments, but it doesn't include any of the pending comments attached to the review. It also doesn't indicate that the review as "pending." It should be obvious that a review is pending if it hasn't been submitted, and we should also show all pending comments .

Can't jump to files that have been renamed

See the PR for #27, for which the diffstat looks like this:

Files changed

4 files changed, 51 insertions(+), 37 deletions(-)
magit-gh-comments-github.el                     | 39 ++++++++++++-------------
magit-gh-utils.el => magit-gh-comments-utils.el |  9 +++---
magit-gh-comments.el                            | 36 ++++++++++++++++-------
test/magit-gh-comments-test.el                  |  4 +--

Following the jumper magit-gh-utils.el => magit-gh-comments-utils.el produces this backtrace:

Debugger entered--Lisp error: (error "Couldn’t find a file in the diff named ‘magit-gh-utils.el => magit-gh-comments-utils.el’")
  signal(error ("Couldn’t find a file in the diff named ‘magit-gh-utils.el => magit-gh-comments-utils.el’"))
  error("Couldn't find a file in the diff named `%s'" "magit-gh-utils.el => magit-gh-comments-utils.el")
  (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))
  (let* ((section (and t (magit-get-section (cons (cons (quote file) filepath) (quote (...))))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))
  (closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #1 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t ...))) (if section (progn (goto-char ...) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons (cons ... filepath) (quote ...)))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))()
  funcall-interactively((closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #1 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t ...))) (if section (progn (goto-char ...) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons (cons ... filepath) (quote ...)))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))))
  #<subr call-interactively>((closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #1 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t ...))) (if section (progn (goto-char ...) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons (cons ... filepath) (quote ...)))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))) nil nil)
  apply(#<subr call-interactively> (closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #1 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t ...))) (if section (progn (goto-char ...) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons (cons ... filepath) (quote ...)))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))) (nil nil))
  (let ((ido-cr+-current-command command)) (apply orig-fun command args))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> (closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #1 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t ...))) (if section (progn (goto-char ...) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons (cons ... filepath) (quote ...)))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))) nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> ((closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #2 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section ...)) (if section (progn ... ...) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons ... ...))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))) nil nil))
  call-interactively((closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #1 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t ...))) (if section (progn (goto-char ...) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons (cons ... filepath) (quote ...)))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))) nil nil)
  command-execute((closure ((pr . [cl-struct-magit-gh-pr "astahlman" "magit-gh-comments" 27 "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea" "Refactoring: represent review as struct instead of alist" "open" "Return a list of structs from `magit-gh-list-reviews' instead of a\nlist of alists. We're now consistent in our internal representation of\nreviews as using the `magit-gh-review' struct.\n\nI also switched to using hashtables in the implementation of\n`magit-gh-list-reviews'. Dealing with three levels of nesting in the\ngrouped list of alists was getting hard to reason about."]) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (keymap keymap (return closure #1 nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t ...))) (if section (progn (goto-char ...) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath))))) (diff-range . "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea") (filepath . "magit-gh-utils.el => magit-gh-comments-utils.el") (end . 638) (start . 591) (match) (_args ("diff" "--stat" "cc7e2ce78c5b27b4545848d2708f83bbb3651d4a..a046d6002db1ea1f14af20c956a559f1837daaea")) t) nil (interactive) (magit-diff diff-range) (set (make-local-variable (quote magit-gh--current-pr)) pr) (let* ((section (and t (magit-get-section (cons (cons ... filepath) (quote ...)))))) (if section (progn (goto-char (eieio-oref section (quote start))) (recenter 0)) (error "Couldn't find a file in the diff named `%s'" filepath)))))

PR view should show list of commits

Should we make this a timeline like view, like Github does? Or put them in their own section?

I'm leaning towards the latter, to start with.

All comments are misplaced when opening PR diff

When the user re-opens a PR diff from Magit, all of the comments appear at very top of the buffer until the user interactively runs `magit-gh-refresh-comments'. The comments should appear in their correct position when the buffer is opened.

Off-by-one when posting comments to Github

When fetching and display comments in a Magit diff buff, the comments appear one below their expected position. I'm not yet sure whether they are being posted to Github with the wrong line number or if the comment display logic has a bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.