Skip to content

Commit a944520

Browse files
authored
Merge pull request #751 from fcollonval/fcollonval/issue749
Add ignore action to context menu for simple staging
2 parents bdf41d2 + 64d02ee commit a944520

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/components/FileList.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
5656
this._contextMenuUntracked = new Menu({ commands });
5757
this._contextMenuUntrackedMin = new Menu({ commands });
5858
this._contextMenuSimpleUntracked = new Menu({ commands });
59+
this._contextMenuSimpleUntrackedMin = new Menu({ commands });
5960
this._contextMenuSimpleTracked = new Menu({ commands });
6061

6162
this.state = {
@@ -239,9 +240,17 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
239240
this._contextMenuSimpleTracked.addItem({ command });
240241
});
241242

242-
[CommandIDs.gitFileOpen].forEach(command => {
243+
[
244+
CommandIDs.gitFileOpen,
245+
CommandIDs.gitIgnore,
246+
CommandIDs.gitIgnoreExtension
247+
].forEach(command => {
243248
this._contextMenuSimpleUntracked.addItem({ command });
244249
});
250+
251+
[CommandIDs.gitFileOpen, CommandIDs.gitIgnore].forEach(command => {
252+
this._contextMenuSimpleUntrackedMin.addItem({ command });
253+
});
245254
}
246255

247256
/** Handle right-click on a staged file */
@@ -270,7 +279,12 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
270279
/** Handle right-click on an untracked file in Simple mode*/
271280
contextMenuSimpleUntracked = (event: React.MouseEvent) => {
272281
event.preventDefault();
273-
this._contextMenuSimpleUntracked.open(event.clientX, event.clientY);
282+
const extension = PathExt.extname(this.state.selectedFile.to);
283+
if (extension.length > 0) {
284+
this._contextMenuSimpleUntracked.open(event.clientX, event.clientY);
285+
} else {
286+
this._contextMenuSimpleUntrackedMin.open(event.clientX, event.clientY);
287+
}
274288
};
275289

276290
/** Handle right-click on an tracked file in Simple mode*/
@@ -821,4 +835,5 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
821835
private _contextMenuUntrackedMin: Menu;
822836
private _contextMenuSimpleTracked: Menu;
823837
private _contextMenuSimpleUntracked: Menu;
838+
private _contextMenuSimpleUntrackedMin: Menu;
824839
}

0 commit comments

Comments
 (0)