4040 :type 'integer
4141 :group 'pr-review )
4242
43+ (defcustom pr-review-fringe-icons t
44+ " Display icons in the fringe indicating PR-review comments."
45+ :type 'boolean
46+ :group 'pr-review )
47+
4348(defun pr-review--format-timestamp (str )
4449 " Convert and format timestamp STR from json."
4550 (concat
@@ -308,6 +313,30 @@ return t on success."
308313 (goto-char (prop-match-beginning match ))
309314 t ))
310315
316+
317+ (define-fringe-bitmap 'pr-review-comment
318+ [#b0000000000000000
319+ #b0000000000000000
320+ #b0000000000000000
321+ #b0000000000000000
322+ #b0000000000000000
323+ #b0111111111111100
324+ #b1111111111111110
325+ #b1111111111111110
326+ #b1110000000011110
327+ #b1111111111111110
328+ #b1111111111111110
329+ #b1110000011111110
330+ #b1111111111111110
331+ #b1111111111111110
332+ #b1111111111111110
333+ #b0111111111111100
334+ #b0000000011111000
335+ #b0000000001111000
336+ #b0000000000111000
337+ #b0000000000011000 ]
338+ nil 16 'center )
339+
311340(defun pr-review--insert-in-diff-pending-review-thread (pending-review-thread &optional allow-fallback )
312341 " Insert a pending review thread inside the diff for PENDING-REVIEW-THREAD.
313342If ALLOW-FALLBACK is non-nil, when the line for the thread cannot be found.
@@ -319,12 +348,18 @@ It will be inserted at the beginning."
319348 allow-fallback)
320349 (forward-line )
321350 (setq beg (point ))
322- (insert (propertize (concat " > PENDING comment for "
323- (if .startLine
324- (format " %s :%s to %s :%s " .startSide .startLine .side .line)
325- (format " %s :%s " .side .line))
326- " \n " )
327- 'face 'pr-review-in-diff-pending-begin-face ))
351+ (insert (apply #'propertize
352+ (concat " > PENDING comment for "
353+ (if .startLine
354+ (format " %s :%s to %s :%s " .startSide .startLine .side .line)
355+ (format " %s :%s " .side .line))
356+ " \n " )
357+ 'face 'pr-review-in-diff-pending-begin-face
358+ (when pr-review-fringe-icons
359+ (list 'line-prefix
360+ (propertize " " 'display '(left-fringe
361+ pr-review-comment
362+ pr-review-fringe-comment-pending))))))
328363 (pr-review--insert-fontified .body 'gfm-mode nil
329364 'pr-review-in-diff-pending-body-face )
330365 (insert (propertize " \n " 'face 'pr-review-in-diff-pending-end-face ))
@@ -345,7 +380,8 @@ It will be inserted at the beginning."
345380 .path .diffSide .line)
346381 (forward-line )
347382 (insert
348- (propertize
383+ (apply
384+ #'propertize
349385 (concat (format " > %s comments from " (length .comments.nodes))
350386 (string-join
351387 (seq-uniq
@@ -358,7 +394,13 @@ It will be inserted at the beginning."
358394 'face 'pr-review-in-diff-thread-title-face
359395 'pr-review-eldoc-content (let-alist (car .comments.nodes)
360396 (concat (pr-review--propertize-username .author.login)
361- " : " .body))))
397+ " : " .body))
398+ (when pr-review-fringe-icons
399+ (list 'line-prefix
400+ (propertize " " 'display `(left-fringe pr-review-comment
401+ (if .isResolved
402+ pr-review-fringe-comment-resolved
403+ pr-review-fringe-comment-open)))))))
362404 (insert-button
363405 " Go to thread"
364406 'face 'pr-review-button-face
0 commit comments