Skip to content

Commit b923327

Browse files
committed
Adds RevealOptions common type
1 parent c09de74 commit b923327

21 files changed

+83
-385
lines changed

src/git/actions/branch.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Container } from '../../container';
22
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
3+
import type { RevealOptions } from '../../views/viewBase';
34
import { executeGitCommand } from '../actions';
45
import type { GitBranchReference, GitReference } from '../models/reference';
56
import type { Repository } from '../models/repository';
@@ -39,13 +40,6 @@ export function rename(repo?: string | Repository, ref?: GitBranchReference, nam
3940
});
4041
}
4142

42-
export function reveal(
43-
branch: GitBranchReference,
44-
options?: {
45-
select?: boolean;
46-
focus?: boolean;
47-
expand?: boolean | number;
48-
},
49-
): Promise<ViewNode | undefined> {
43+
export function reveal(branch: GitBranchReference, options?: RevealOptions): Promise<ViewNode | undefined> {
5044
return Container.instance.views.revealBranch(branch, options);
5145
}

src/git/actions/commit.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { configuration } from '../../system/-webview/configuration';
1919
import { getOrOpenTextEditor, openChangesEditor, openTextEditors } from '../../system/-webview/vscode/editors';
2020
import { getSettledValue } from '../../system/promise';
2121
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
22+
import type { RevealOptions } from '../../views/viewBase';
2223
import type { ShowInCommitGraphCommandArgs } from '../../webviews/plus/graph/registration';
2324
import { GitUri } from '../gitUri';
2425
import type { GitCommit } from '../models/commit';
@@ -689,14 +690,7 @@ export async function restoreFile(file: string | GitFile, revision: GitRevisionR
689690
await Container.instance.git.getRepositoryService(revision.repoPath).checkout(ref, { path: path });
690691
}
691692

692-
export function reveal(
693-
commit: GitRevisionReference,
694-
options?: {
695-
select?: boolean;
696-
focus?: boolean;
697-
expand?: boolean | number;
698-
},
699-
): Promise<ViewNode | undefined> {
693+
export function reveal(commit: GitRevisionReference, options?: RevealOptions): Promise<ViewNode | undefined> {
700694
return Container.instance.views.revealCommit(commit, options);
701695
}
702696

src/git/actions/contributor.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Container } from '../../container';
22
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
3+
import type { RevealOptions } from '../../views/viewBase';
34
import { executeGitCommand } from '../actions';
45
import type { GitContributor } from '../models/contributor';
56
import type { Repository } from '../models/repository';
@@ -14,13 +15,6 @@ export function addAuthors(
1415
});
1516
}
1617

17-
export function reveal(
18-
contributor: GitContributor,
19-
options?: {
20-
select?: boolean;
21-
focus?: boolean;
22-
expand?: boolean | number;
23-
},
24-
): Promise<ViewNode | undefined> {
18+
export function reveal(contributor: GitContributor, options?: RevealOptions): Promise<ViewNode | undefined> {
2519
return Container.instance.views.revealContributor(contributor, options);
2620
}

src/git/actions/remote.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Container } from '../../container';
22
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
3+
import type { RevealOptions } from '../../views/viewBase';
34
import { executeGitCommand } from '../actions';
45
import type { GitRemote } from '../models/remote';
56
import type { Repository } from '../models/repository';
@@ -49,13 +50,6 @@ export async function remove(repo: string | Repository, remote: string): Promise
4950
});
5051
}
5152

52-
export function reveal(
53-
remote: GitRemote | undefined,
54-
options?: {
55-
select?: boolean;
56-
focus?: boolean;
57-
expand?: boolean | number;
58-
},
59-
): Promise<ViewNode | undefined> {
53+
export function reveal(remote: GitRemote | undefined, options?: RevealOptions): Promise<ViewNode | undefined> {
6054
return Container.instance.views.revealRemote(remote, options);
6155
}

src/git/actions/repository.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Container } from '../../container';
22
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
3-
import type { ViewsWithRepositoryFolders } from '../../views/viewBase';
3+
import type { RevealOptions, ViewsWithRepositoryFolders } from '../../views/viewBase';
44
import { executeGitCommand } from '../actions';
55
import type { GitBranchReference, GitReference, GitRevisionReference, GitTagReference } from '../models/reference';
66
import type { Repository } from '../models/repository';
@@ -89,11 +89,7 @@ export function switchTo(
8989
export function reveal(
9090
repoPath: string,
9191
view?: ViewsWithRepositoryFolders,
92-
options?: {
93-
select?: boolean;
94-
focus?: boolean;
95-
expand?: boolean | number;
96-
},
92+
options?: RevealOptions,
9793
): Promise<ViewNode | undefined> {
9894
return Container.instance.views.revealRepository(repoPath, view, options);
9995
}

src/git/actions/stash.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Uri } from 'vscode';
22
import type { PushFlags } from '../../commands/git/stash';
33
import { Container } from '../../container';
44
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
5+
import type { RevealOptions } from '../../views/viewBase';
56
import { executeGitCommand } from '../actions';
67
import type { GitStashCommit } from '../models/commit';
78
import type { GitStashReference } from '../models/reference';
@@ -61,14 +62,7 @@ export function push(
6162
});
6263
}
6364

64-
export function reveal(
65-
stash: GitStashReference,
66-
options?: {
67-
select?: boolean;
68-
focus?: boolean;
69-
expand?: boolean | number;
70-
},
71-
): Promise<ViewNode | undefined> {
65+
export function reveal(stash: GitStashReference, options?: RevealOptions): Promise<ViewNode | undefined> {
7266
return Container.instance.views.revealStash(stash, options);
7367
}
7468

src/git/actions/tag.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Container } from '../../container';
22
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
3+
import type { RevealOptions } from '../../views/viewBase';
34
import { executeGitCommand } from '../actions';
45
import type { GitReference, GitTagReference } from '../models/reference';
56
import type { Repository } from '../models/repository';
@@ -27,13 +28,6 @@ export function remove(repo?: string | Repository, refs?: GitTagReference | GitT
2728
});
2829
}
2930

30-
export function reveal(
31-
tag: GitTagReference,
32-
options?: {
33-
select?: boolean;
34-
focus?: boolean;
35-
expand?: boolean | number;
36-
},
37-
): Promise<ViewNode | undefined> {
31+
export function reveal(tag: GitTagReference, options?: RevealOptions): Promise<ViewNode | undefined> {
3832
return Container.instance.views.revealTag(tag, options);
3933
}

src/git/actions/worktree.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Container } from '../../container';
44
import type { OpenWorkspaceLocation } from '../../system/-webview/vscode/workspaces';
55
import { defer } from '../../system/promise';
66
import type { ViewNode } from '../../views/nodes/abstract/viewNode';
7+
import type { RevealOptions } from '../../views/viewBase';
78
import { executeGitCommand } from '../actions';
89
import type { GitReference } from '../models/reference';
910
import type { Repository } from '../models/repository';
@@ -80,10 +81,7 @@ export function remove(repo?: string | Repository, uris?: Uri[]): Promise<void>
8081
});
8182
}
8283

83-
export function reveal(
84-
worktree: GitWorktree,
85-
options?: { select?: boolean; focus?: boolean; expand?: boolean | number },
86-
): Promise<ViewNode | undefined> {
84+
export function reveal(worktree: GitWorktree, options?: RevealOptions): Promise<ViewNode | undefined> {
8785
return Container.instance.views.revealWorktree(worktree, options);
8886
}
8987

src/views/branchesView.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import type { ViewNode } from './nodes/abstract/viewNode';
2020
import { BranchesNode } from './nodes/branchesNode';
2121
import { BranchNode } from './nodes/branchNode';
2222
import { BranchOrTagFolderNode } from './nodes/branchOrTagFolderNode';
23-
import type { GroupedViewContext } from './viewBase';
23+
import type { GroupedViewContext, RevealOptions } from './viewBase';
2424
import { ViewBase } from './viewBase';
2525
import type { CopyNodeCommandArgs } from './viewCommands';
2626
import { registerViewCommand } from './viewCommands';
@@ -281,14 +281,7 @@ export class BranchesView extends ViewBase<'branches', BranchesViewNode, Branche
281281
}
282282

283283
@gate(() => '')
284-
async revealBranch(
285-
branch: GitBranchReference,
286-
options?: {
287-
select?: boolean;
288-
focus?: boolean;
289-
expand?: boolean | number;
290-
},
291-
): Promise<ViewNode | undefined> {
284+
async revealBranch(branch: GitBranchReference, options?: RevealOptions): Promise<ViewNode | undefined> {
292285
return window.withProgress(
293286
{
294287
location: ProgressLocation.Notification,
@@ -310,14 +303,7 @@ export class BranchesView extends ViewBase<'branches', BranchesViewNode, Branche
310303
}
311304

312305
@gate(() => '')
313-
async revealCommit(
314-
commit: GitRevisionReference,
315-
options?: {
316-
select?: boolean;
317-
focus?: boolean;
318-
expand?: boolean | number;
319-
},
320-
): Promise<ViewNode | undefined> {
306+
async revealCommit(commit: GitRevisionReference, options?: RevealOptions): Promise<ViewNode | undefined> {
321307
return window.withProgress(
322308
{
323309
location: ProgressLocation.Notification,
@@ -339,10 +325,7 @@ export class BranchesView extends ViewBase<'branches', BranchesViewNode, Branche
339325
}
340326

341327
@gate(() => '')
342-
async revealRepository(
343-
repoPath: string,
344-
options?: { select?: boolean; focus?: boolean; expand?: boolean | number },
345-
): Promise<ViewNode | undefined> {
328+
async revealRepository(repoPath: string, options?: RevealOptions): Promise<ViewNode | undefined> {
346329
const node = await this.findNode(n => n instanceof RepositoryFolderNode && n.repoPath === repoPath, {
347330
maxDepth: 1,
348331
canTraverse: n => n instanceof BranchesViewNode || n instanceof RepositoryFolderNode,

src/views/commitsView.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import type { ViewNode } from './nodes/abstract/viewNode';
2828
import { BranchNode } from './nodes/branchNode';
2929
import { BranchTrackingStatusNode } from './nodes/branchTrackingStatusNode';
3030
import { CommandMessageNode } from './nodes/common';
31-
import type { GroupedViewContext } from './viewBase';
31+
import type { GroupedViewContext, RevealOptions } from './viewBase';
3232
import { ViewBase } from './viewBase';
3333
import type { CopyNodeCommandArgs } from './viewCommands';
3434
import { registerViewCommand } from './viewCommands';
@@ -396,14 +396,7 @@ export class CommitsView extends ViewBase<'commits', CommitsViewNode, CommitsVie
396396
}
397397

398398
@gate(() => '')
399-
async revealCommit(
400-
commit: GitRevisionReference,
401-
options?: {
402-
select?: boolean;
403-
focus?: boolean;
404-
expand?: boolean | number;
405-
},
406-
): Promise<ViewNode | undefined> {
399+
async revealCommit(commit: GitRevisionReference, options?: RevealOptions): Promise<ViewNode | undefined> {
407400
return window.withProgress(
408401
{
409402
location: ProgressLocation.Notification,
@@ -425,10 +418,7 @@ export class CommitsView extends ViewBase<'commits', CommitsViewNode, CommitsVie
425418
}
426419

427420
@gate(() => '')
428-
async revealRepository(
429-
repoPath: string,
430-
options?: { select?: boolean; focus?: boolean; expand?: boolean | number },
431-
): Promise<ViewNode | undefined> {
421+
async revealRepository(repoPath: string, options?: RevealOptions): Promise<ViewNode | undefined> {
432422
const node = await this.findNode(n => n instanceof RepositoryFolderNode && n.repoPath === repoPath, {
433423
maxDepth: 1,
434424
canTraverse: n => n instanceof CommitsViewNode || n instanceof RepositoryFolderNode,

0 commit comments

Comments
 (0)