@@ -27,7 +27,7 @@ const defaultState = {
27
27
28
28
export default class GithubPackage {
29
29
constructor ( workspace , project , commandRegistry , notificationManager , tooltips , styles , grammars , confirm , config ,
30
- configDirPath , getLoadSettings ) {
30
+ configDirPath , getLoadSettings , contextMenu ) {
31
31
this . workspace = workspace ;
32
32
this . project = project ;
33
33
this . commandRegistry = commandRegistry ;
@@ -37,6 +37,7 @@ export default class GithubPackage {
37
37
this . styles = styles ;
38
38
this . grammars = grammars ;
39
39
this . configPath = path . join ( configDirPath , 'github.cson' ) ;
40
+ this . contextMenu = contextMenu ;
40
41
41
42
this . styleCalculator = new StyleCalculator ( this . styles , this . config ) ;
42
43
this . confirm = confirm ;
@@ -130,6 +131,10 @@ export default class GithubPackage {
130
131
await writeFile ( this . configPath , '# Store non-visible GitHub package state.\n' ) ;
131
132
}
132
133
134
+ const hasSelectedFiles = event => {
135
+ return ! ! event . target . closest ( '.github-FilePatchListView' ) . querySelector ( '.is-selected' ) ;
136
+ } ;
137
+
133
138
this . subscriptions . add (
134
139
atom . config . onDidChange ( 'github.useLegacyPanels' , ( { newValue} ) => {
135
140
if ( newValue ) {
@@ -166,6 +171,52 @@ export default class GithubPackage {
166
171
}
167
172
} ) ,
168
173
this . workspace . addOpener ( IssueishPaneItem . opener ) ,
174
+ this . contextMenu . add ( {
175
+ '.github-UnstagedChanges .github-FilePatchListView' : [
176
+ {
177
+ label : 'Stage' ,
178
+ command : 'core:confirm' ,
179
+ shouldDisplay : hasSelectedFiles ,
180
+ } ,
181
+ {
182
+ type : 'separator' ,
183
+ shouldDisplay : hasSelectedFiles ,
184
+ } ,
185
+ {
186
+ label : 'Discard Changes' ,
187
+ command : 'github:discard-changes-in-selected-files' ,
188
+ shouldDisplay : hasSelectedFiles ,
189
+ } ,
190
+ ] ,
191
+ '.github-StagedChanges .github-FilePatchListView' : [
192
+ {
193
+ label : 'Unstage' ,
194
+ command : 'core:confirm' ,
195
+ shouldDisplay : hasSelectedFiles ,
196
+ } ,
197
+ ] ,
198
+ '.github-MergeConflictPaths .github-FilePatchListView' : [
199
+ {
200
+ label : 'Stage' ,
201
+ command : 'core:confirm' ,
202
+ shouldDisplay : hasSelectedFiles ,
203
+ } ,
204
+ {
205
+ type : 'separator' ,
206
+ shouldDisplay : hasSelectedFiles ,
207
+ } ,
208
+ {
209
+ label : 'Resolve File As Ours' ,
210
+ command : 'github:resolve-file-as-ours' ,
211
+ shouldDisplay : hasSelectedFiles ,
212
+ } ,
213
+ {
214
+ label : 'Resolve File As Theirs' ,
215
+ command : 'github:resolve-file-as-theirs' ,
216
+ shouldDisplay : hasSelectedFiles ,
217
+ } ,
218
+ ] ,
219
+ } ) ,
169
220
) ;
170
221
171
222
this . activated = true ;
0 commit comments