-
Notifications
You must be signed in to change notification settings - Fork 2
/
pr-review-common.el
167 lines (127 loc) · 4.82 KB
/
pr-review-common.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
;;; pr-review-common.el --- Common definitions for pr-review -*- lexical-binding: t; -*-
;; Copyright (C) 2021 Yikai Zhao
;; Author: Yikai Zhao <[email protected]>
;; Keywords: tools
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'magit-section)
(defgroup pr-review nil "Pr review."
:group 'tools)
(defface pr-review-title-face
'((t :inherit outline-1))
"Face used for title."
:group 'pr-review)
(defface pr-review-state-face
'((t :inherit bold))
"Face used for default state keywords."
:group 'pr-review)
(defface pr-review-error-state-face
'((t :inherit font-lock-warning-face :weight bold))
"Face used for error state (e.g. changes requested)."
:group 'pr-review)
(defface pr-review-success-state-face
'((t :inherit font-lock-constant-face :weight bold))
"Face used for success state (e.g. merged)."
:group 'pr-review)
(defface pr-review-info-state-face
'((t :slant italic))
"Face used for info (unimportant) state (e.g. resolved)."
:group 'pr-review)
(defface pr-review-author-face
'((t :inherit font-lock-keyword-face))
"Face used for author names."
:group 'pr-review)
(defface pr-review-timestamp-face
'((t :slant italic))
"Face used for timestamps."
:group 'pr-review)
(defface pr-review-branch-face
'((t :inherit font-lock-variable-name-face))
"Face used for branchs."
:group 'pr-review)
(defface pr-review-hash-face
'((t :inherit font-lock-comment-face))
"Face used for commit hash."
:group 'pr-review)
(defface pr-review-label-face
'((t :box t :foregroud "black"))
"Face used for labels."
:group 'pr-review)
(defface pr-review-thread-item-title-face
'((t :inherit bold))
"Face used for title of review thread item."
:group 'pr-review)
(defface pr-review-thread-diff-begin-face
'((t :underline t :extend t :inherit font-lock-comment-face))
"Face used for the beginning of thread diff hunk."
:group 'pr-review)
(defface pr-review-thread-diff-end-face
'((t :overline t :extend t :inherit font-lock-comment-face))
"Face used for the beginning of thread diff hunk."
:group 'pr-review)
(defface pr-review-in-diff-thread-title-face
'((t :inherit font-lock-comment-face))
"Face used for the title of the in-diff thread title."
:group 'pr-review)
(defface pr-review-in-diff-pending-begin-face
'((t :underline t :extend t :inherit bold-italic))
"Face used for start line of pending-thread in the diff."
:group 'pr-review)
(defface pr-review-in-diff-pending-end-face
'((t :overline t :extend t :height 0.5 :inherit bold-italic))
"Face used for end line of pending-thread in the diff."
:group 'pr-review)
(defface pr-review-link-face
'((t :underline t))
"Face used for links."
:group 'pr-review)
(defface pr-review-button-face
'((t :underline t :slant italic))
"Face used for buttons."
:group 'pr-review)
;; section classes
(defclass pr-review--review-section (magit-section)
((body :initform nil)
(updatable :initform nil)
(databaseId :initform nil)))
(defclass pr-review--comment-section (magit-section)
((body :initform nil)
(updatable :initform nil)
(databaseId :initform nil)))
(defclass pr-review--diff-section (magit-section) ())
(defclass pr-review--check-section (magit-section) ())
(defclass pr-review--commit-section (magit-section) ())
(defclass pr-review--review-thread-section (magit-section)
((top-comment-id :initform nil)
(is-resolved :initform nil)))
(defclass pr-review--review-thread-item-section (magit-section)
((body :initform nil)
(updatable :initform nil)
(databaseId :initform nil)))
(defclass pr-review--root-section (magit-section)
((title :initform nil)
(updatable :initform nil)))
(defclass pr-review--description-section (magit-section)
((body :initform nil)
(updatable :initform nil)))
(defclass pr-review--event-section (magit-section) ())
(defvar-local pr-review--pr-path nil "List of repo-owner, repo-name, pr-id.")
(defvar-local pr-review--pr-info nil "Result of fetch-pr-info, useful for actions.")
(defvar-local pr-review--pending-review-threads nil)
(defcustom pr-review-generated-file-regexp ".*generated/.*"
"Regexe that match generated files, which would be collapsed in review."
:type 'regexp
:group 'pr-review)
(provide 'pr-review-common)
;;; pr-review-common.el ends here