Skip to content

Commit e316659

Browse files
committed
Cleans up some nitpick issues
1 parent 61e3708 commit e316659

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/commands/externalDiff.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,34 @@ interface Resource extends SourceControlResourceState {
4040
}
4141

4242
class ExternalDiffFile {
43-
constructor(public uri: Uri, public staged: boolean) {
44-
}
43+
44+
constructor(public uri: Uri, public staged: boolean) { }
4545
}
4646

4747
export interface ExternalDiffCommandArgs {
4848
files?: ExternalDiffFile[];
4949
}
5050

5151
export class ExternalDiffCommand extends Command {
52+
5253
constructor(private git: GitService) {
5354
super(Commands.ExternalDiff);
5455
}
5556

5657
protected async preExecute(context: CommandContext, args: ExternalDiffCommandArgs = {}): Promise<any> {
5758
if (context.type === 'scm-states') {
5859
args = { ...args };
59-
args.files = context.scmResourceStates.map<ExternalDiffFile>((_: Resource) => new ExternalDiffFile(_.resourceUri, _.resourceGroupType === ResourceGroupType.Index));
60+
args.files = context.scmResourceStates
61+
.map<ExternalDiffFile>((r: Resource) => new ExternalDiffFile(r.resourceUri, r.resourceGroupType === ResourceGroupType.Index));
6062

6163
return this.execute(args);
6264
} else if (context.type === 'scm-groups') {
6365
const isModified = (status: Status): boolean => status === Status.BOTH_MODIFIED || status === Status.INDEX_MODIFIED || status === Status.MODIFIED;
6466

6567
args = { ...args };
66-
args.files = context.scmResourceGroups[0].resourceStates.filter((_: Resource) => isModified(_.type)).map<ExternalDiffFile>((_: Resource) => new ExternalDiffFile(_.resourceUri, _.resourceGroupType === ResourceGroupType.Index));
68+
args.files = context.scmResourceGroups[0].resourceStates
69+
.filter((r: Resource) => isModified(r.type))
70+
.map<ExternalDiffFile>((r: Resource) => new ExternalDiffFile(r.resourceUri, r.resourceGroupType === ResourceGroupType.Index));
6771

6872
return this.execute(args);
6973
}
@@ -84,7 +88,7 @@ export class ExternalDiffCommand extends Command {
8488
const repoPath = await this.git.getRepoPathFromUri(undefined);
8589
if (!repoPath) return Messages.showNoRepositoryWarningMessage(`Unable to open changed files`);
8690

87-
if (!args.files) {
91+
if (args.files === undefined) {
8892
const status = await this.git.getStatusForRepo(repoPath);
8993
if (status === undefined) return window.showWarningMessage(`Unable to open changed files`);
9094

0 commit comments

Comments
 (0)