瀏覽代碼

Adds preview extensibility apis

Adds preview action runner extensibility api
main
Eric Amodio 4 年之前
父節點
當前提交
11d3280289
共有 13 個文件被更改,包括 423 次插入22 次删除
  1. +3
    -0
      CHANGELOG.md
  2. +41
    -1
      package.json
  3. +155
    -0
      src/api/actionRunners.ts
  4. +40
    -0
      src/api/api.ts
  5. +40
    -0
      src/api/gitlens.d.ts
  6. +6
    -0
      src/commands/common.ts
  7. +1
    -0
      src/constants.ts
  8. +30
    -17
      src/container.ts
  9. +9
    -4
      src/extension.ts
  10. +16
    -0
      src/git/models/models.ts
  11. +15
    -0
      src/git/models/remote.ts
  12. +44
    -0
      src/views/viewCommands.ts
  13. +23
    -0
      test/extension.test.ts

+ 3
- 0
CHANGELOG.md 查看文件

@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds an _Open File on Remote From..._ command (`gitlens.openFileOnRemoteFrom`) to open a file or revision on a specific branch or tag on the remote provider — closes [#1071](https://github.com/eamodio/vscode-gitlens/issues/1071)
- Adds a _Copy Remote File Url From..._ command (`gitlens.copyRemoteFileUrlFrom`) to copy the url of a file or revision on a specific branch or tag the remote provider — closes [#1071](https://github.com/eamodio/vscode-gitlens/issues/1071)
- Adds a welcome, i.e. richer empty state, to the _Search & Compare_ view
- Adds preview extensibility APIs
- Adds a preview _action runner_ extensibility point to provide a runner (handler) for a new _createPullRequest_ and _openPullRequest_ actions — see `gitlens.d.ts` for API definitions
- Preview APIs are only available in the Insiders edition
### Changed

+ 41
- 1
package.json 查看文件

@ -3195,7 +3195,7 @@
},
{
"command": "gitlens.openPullRequestOnRemote",
"title": "Open Pull Request",
"title": "Open Pull Request on Remote",
"category": "GitLens",
"icon": "$(globe)"
},
@ -3766,6 +3766,18 @@
"icon": "$(compare-changes)"
},
{
"command": "gitlens.views.createPullRequest",
"title": "Create Pull Request",
"category": "GitLens",
"icon": "$(git-pull-request)"
},
{
"command": "gitlens.views.openPullRequest",
"title": "Open Pull Request",
"category": "GitLens",
"icon": "$(git-pull-request)"
},
{
"command": "gitlens.views.clearNode",
"title": "Clear",
"category": "GitLens",
@ -5176,6 +5188,14 @@
"when": "false"
},
{
"command": "gitlens.views.createPullRequest",
"when": "false"
},
{
"command": "gitlens.views.openPullRequest",
"when": "false"
},
{
"command": "gitlens.views.clearNode",
"when": "false"
},
@ -6675,6 +6695,11 @@
"alt": "gitlens.copyRemoteBranchUrl"
},
{
"command": "gitlens.views.createPullRequest",
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(tracking|remote)\\b)/",
"group": "2_gitlens_quickopen@2"
},
{
"command": "gitlens.views.openDirectoryDiffWithWorking",
"when": "viewItem =~ /gitlens:(branch|tag)\\b/",
"group": "3_gitlens_explore@2"
@ -6990,6 +7015,11 @@
"alt": "gitlens.copyRemoteFileUrlToClipboard"
},
{
"command": "gitlens.views.openPullRequest",
"when": "gitlens:action:openPullRequest && viewItem =~ /gitlens:pullrequest\\b/",
"group": "inline@1"
},
{
"command": "gitlens.openPullRequestOnRemote",
"when": "viewItem =~ /gitlens:pullrequest\\b/",
"group": "inline@99",
@ -7192,6 +7222,11 @@
"group": "inline@2"
},
{
"command": "gitlens.views.createPullRequest",
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!none)/",
"group": "inline@3"
},
{
"command": "gitlens.openBranchOnRemote",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status:upstream:(?!none)/",
"group": "inline@99",
@ -7218,6 +7253,11 @@
"group": "1_gitlens_actions@3"
},
{
"command": "gitlens.views.createPullRequest",
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!none)/",
"group": "1_gitlens_actions@4"
},
{
"command": "gitlens.views.dismissNode",
"when": "viewItem =~ /gitlens:(compare:picker|(compare|search):results(?!:)\\b(?!.*?\\b\\+pinned\\b))\\b(?!:(commits|files))/",
"group": "inline@99"

+ 155
- 0
src/api/actionRunners.ts 查看文件

@ -0,0 +1,155 @@
'use strict';
import { commands, Disposable, QuickPickItem, window } from 'vscode';
import { ContextKeys, setContext } from '../constants';
import { getQuickPickIgnoreFocusOut } from '../quickpicks';
import { Action, ActionContext, ActionRunner } from './gitlens';
type Actions = ActionContext['type'];
const actions: Actions[] = ['createPullRequest', 'openPullRequest'];
export class ActionRunnerQuickPickItem implements QuickPickItem {
constructor(public readonly runner: ActionRunner) {}
get label(): string {
return this.runner.label;
}
}
class RegisteredActionRunner implements ActionRunner, Disposable {
constructor(private readonly runner: ActionRunner, private readonly unregister: () => void) {}
dispose() {
this.unregister();
}
get label(): string {
return this.runner.label;
}
run(context: ActionContext): void | Promise<void> {
return this.runner.run(context);
}
}
export class ActionRunners implements Disposable {
private readonly _actionRunners = new Map<Actions, RegisteredActionRunner[]>();
private readonly _disposable: Disposable;
constructor() {
const subscriptions: Disposable[] = [];
for (const action of actions) {
subscriptions.push(
commands.registerCommand(`gitlens.action.${action}`, (context: ActionContext) => this.run(context)),
);
}
this._disposable = Disposable.from(...subscriptions);
}
dispose() {
this._disposable.dispose();
for (const runners of this._actionRunners.values()) {
for (const runner of runners) {
runner.dispose();
}
}
this._actionRunners.clear();
}
has(action: Actions): boolean {
return (this._actionRunners.get(action)?.length ?? 0) > 0;
}
register<T extends ActionContext>(action: Action<T>, runner: ActionRunner): Disposable {
let runners = this._actionRunners.get(action);
if (runners == null) {
runners = [];
this._actionRunners.set(action, runners);
}
const runnersMap = this._actionRunners;
const updateContextKeys = this._updateContextKeys.bind(this);
const registeredRunner = new RegisteredActionRunner(runner, function (this: RegisteredActionRunner) {
if (runners!.length === 1) {
runnersMap.delete(action);
void updateContextKeys(action);
} else {
const index = runners!.indexOf(this);
if (index !== -1) {
runners!.splice(index, 1);
}
}
});
runners.push(registeredRunner);
void this._updateContextKeys(action);
return {
dispose: () => registeredRunner.dispose(),
};
}
async run<T extends ActionContext>(context: T) {
const runners = this._actionRunners.get(context.type);
if (runners == null || runners.length === 0) return;
let runner;
if (runners.length > 1) {
const items = runners.map(r => new ActionRunnerQuickPickItem(r));
const quickpick = window.createQuickPick<ActionRunnerQuickPickItem>();
quickpick.ignoreFocusOut = getQuickPickIgnoreFocusOut();
const disposables: Disposable[] = [];
try {
const pick = await new Promise<ActionRunnerQuickPickItem | undefined>(resolve => {
disposables.push(
quickpick.onDidHide(() => resolve(undefined)),
quickpick.onDidAccept(() => {
if (quickpick.activeItems.length !== 0) {
resolve(quickpick.activeItems[0]);
}
}),
);
let title;
let placeholder;
switch (context.type) {
case 'createPullRequest':
title = 'Create Pull Request';
placeholder = 'Choose which provider to use to create a pull request';
break;
case 'openPullRequest':
title = 'Open Pull Request';
placeholder = 'Choose which provider to use to open the pull request';
break;
}
quickpick.title = title;
quickpick.placeholder = placeholder;
quickpick.matchOnDetail = true;
quickpick.items = items;
quickpick.show();
});
if (pick == null) return;
runner = pick.runner;
} finally {
quickpick.dispose();
disposables.forEach(d => d.dispose());
}
} else {
[runner] = runners;
}
await runner.run(context);
}
private async _updateContextKeys(action: Actions) {
await setContext(`${ContextKeys.ActionPrefix}${action}`, this.has(action));
}
}

+ 40
- 0
src/api/api.ts 查看文件

@ -0,0 +1,40 @@
'use strict';
import { Disposable } from 'vscode';
import { Container } from '../container';
import { Logger } from '../logger';
import { Action, ActionContext, ActionRunner, GitLensApi } from './gitlens';
const emptyDisposable = Object.freeze({
// eslint-disable-next-line @typescript-eslint/no-empty-function
dispose: () => {},
});
export class Api implements GitLensApi {
@preview()
registerActionRunner<T extends ActionContext>(action: Action<T>, runner: ActionRunner): Disposable {
return Container.actionRunners.register(action, runner);
}
// registerAutolinkProvider(provider: RemoteProvider): Disposable;
// registerPullRequestProvider(provider: RemoteProvider): Disposable;
// registerRemoteProvider(matcher: string | RegExp, provider: RemoteProvider | RichRemoteProvider): Disposable;
}
export function preview() {
return (target: any, key: string, descriptor: PropertyDescriptor) => {
let fn: Function | undefined;
if (typeof descriptor.value === 'function') {
fn = descriptor.value;
} else if (typeof descriptor.get === 'function') {
fn = descriptor.get;
}
if (fn == null) throw new Error('Not supported');
descriptor.value = function (this: any, ...args: any[]) {
if (Container.insiders || Logger.isDebugging) return fn!.apply(this, args);
console.error('GitLens preview APIs are only available in the Insiders edition');
return emptyDisposable;
};
};
}

+ 40
- 0
src/api/gitlens.d.ts 查看文件

@ -0,0 +1,40 @@
'use strict';
import { Disposable } from 'vscode';
export { Disposable } from 'vscode';
export interface CreatePullRequestActionContext {
readonly type: 'createPullRequest';
readonly branch: {
readonly name: string;
readonly remote?: {
readonly name: string;
readonly provider?: string;
readonly url?: string;
};
readonly repoPath: string;
};
}
export interface OpenPullRequestActionContext {
readonly type: 'openPullRequest';
readonly pullRequest: {
readonly id: string;
readonly provider: string;
readonly repoPath: string;
readonly url: string;
};
}
export type ActionContext = CreatePullRequestActionContext | OpenPullRequestActionContext;
export type Action<T extends ActionContext> = T['type'];
export interface ActionRunner {
readonly label: string;
run(context: ActionContext): void | Promise<void>;
}
export interface GitLensApi {
registerActionRunner<T extends ActionContext>(action: Action<T>, runner: ActionRunner): Disposable;
}

+ 6
- 0
src/commands/common.ts 查看文件

@ -16,6 +16,7 @@ import {
window,
workspace,
} from 'vscode';
import { Action, ActionContext } from '../api/gitlens';
import { BuiltInCommands, DocumentSchemes, ImageMimetypes } from '../constants';
import { Container } from '../container';
import { GitBranch, GitCommit, GitContributor, GitFile, GitRemote, GitTag, Repository } from '../git/git';
@ -25,6 +26,7 @@ import { CommandQuickPickItem, RepositoryPicker } from '../quickpicks';
import { ViewNode, ViewRefNode } from '../views/nodes';
export enum Commands {
ActionPrefix = 'gitlens.action.',
AddAuthors = 'gitlens.addAuthors',
BrowseRepoAtRevision = 'gitlens.browseRepoAtRevision',
BrowseRepoAtRevisionInNewWindow = 'gitlens.browseRepoAtRevisionInNewWindow',
@ -167,6 +169,10 @@ export enum Commands {
Deprecated_OpenRepoInRemote = 'gitlens.openRepoInRemote',
}
export function executeActionCommand<T extends ActionContext>(action: Action<T>, args: Omit<T, 'type'>) {
return commands.executeCommand(`${Commands.ActionPrefix}${action}`, { ...args, type: action });
}
export function executeCommand<T>(command: Commands, args: T) {
return commands.executeCommand(command, args);
}

+ 1
- 0
src/constants.ts 查看文件

@ -26,6 +26,7 @@ export enum BuiltInCommands {
}
export enum ContextKeys {
ActionPrefix = 'gitlens:action:',
ActiveFileStatus = 'gitlens:activeFileStatus',
AnnotationStatus = 'gitlens:annotationStatus',
DisabledToggleCodeLens = 'gitlens:disabledToggleCodeLens',

+ 30
- 17
src/container.ts 查看文件

@ -3,6 +3,7 @@ import { commands, ConfigurationChangeEvent, ConfigurationScope, ExtensionContex
import { Autolinks } from './annotations/autolinks';
import { FileAnnotationController } from './annotations/fileAnnotationController';
import { LineAnnotationController } from './annotations/lineAnnotationController';
import { ActionRunners } from './api/actionRunners';
import { resetAvatarCache } from './avatars';
import { GitCodeLensController } from './codelens/codeLensController';
import { Commands, ToggleFileAnnotationCommandArgs } from './commands';
@ -13,6 +14,7 @@ import { LineHoverController } from './hovers/lineHoverController';
import { Keyboard } from './keyboard';
import { Logger } from './logger';
import { StatusBarController } from './statusbar/statusBarController';
import { memoize } from './system/decorators/memoize';
import { GitTerminalLinkProvider } from './terminal/linkProvider';
import { GitDocumentTracker } from './trackers/gitDocumentTracker';
import { GitLineTracker } from './trackers/gitLineTracker';
@ -43,6 +45,7 @@ export class Container {
this._context = context;
this._config = Container.applyMode(config);
context.subscriptions.push((this._actionRunners = new ActionRunners()));
context.subscriptions.push((this._lineTracker = new GitLineTracker()));
context.subscriptions.push((this._tracker = new GitDocumentTracker()));
context.subscriptions.push((this._vsls = new VslsController()));
@ -111,16 +114,25 @@ export class Container {
}
if (configuration.changed(e.change, 'mode') || configuration.changed(e.change, 'modes')) {
if (this._applyModeConfigurationTransformBound === undefined) {
if (this._applyModeConfigurationTransformBound == null) {
this._applyModeConfigurationTransformBound = this.applyModeConfigurationTransform.bind(this);
}
e.transform = this._applyModeConfigurationTransformBound;
}
}
private static _actionRunners: ActionRunners;
static get actionRunners() {
if (this._actionRunners == null) {
this._context.subscriptions.push((this._actionRunners = new ActionRunners()));
}
return this._actionRunners;
}
private static _autolinks: Autolinks;
static get autolinks() {
if (this._autolinks === undefined) {
if (this._autolinks == null) {
this._context.subscriptions.push((this._autolinks = new Autolinks()));
}
@ -134,7 +146,7 @@ export class Container {
private static _branchesView: BranchesView | undefined;
static get branchesView() {
if (this._branchesView === undefined) {
if (this._branchesView == null) {
this._context.subscriptions.push((this._branchesView = new BranchesView()));
}
@ -143,7 +155,7 @@ export class Container {
private static _commitsView: CommitsView | undefined;
static get commitsView() {
if (this._commitsView === undefined) {
if (this._commitsView == null) {
this._context.subscriptions.push((this._commitsView = new CommitsView()));
}
@ -152,7 +164,7 @@ export class Container {
private static _config: Config | undefined;
static get config() {
if (this._config === undefined) {
if (this._config == null) {
this._config = Container.applyMode(configuration.get());
}
return this._config;
@ -165,7 +177,7 @@ export class Container {
private static _contributorsView: ContributorsView | undefined;
static get contributorsView() {
if (this._contributorsView === undefined) {
if (this._contributorsView == null) {
this._context.subscriptions.push((this._contributorsView = new ContributorsView()));
}
@ -184,7 +196,7 @@ export class Container {
private static _fileHistoryView: FileHistoryView | undefined;
static get fileHistoryView() {
if (this._fileHistoryView === undefined) {
if (this._fileHistoryView == null) {
this._context.subscriptions.push((this._fileHistoryView = new FileHistoryView()));
}
@ -198,7 +210,7 @@ export class Container {
private static _github: Promise<import('./github/github').GitHubApi | undefined> | undefined;
static get github() {
if (this._github === undefined) {
if (this._github == null) {
this._github = this._loadGitHubApi();
}
@ -214,6 +226,7 @@ export class Container {
}
}
@memoize()
static get insiders() {
return this._extensionId.endsWith('-insiders');
}
@ -230,7 +243,7 @@ export class Container {
private static _lineHistoryView: LineHistoryView | undefined;
static get lineHistoryView() {
if (this._lineHistoryView === undefined) {
if (this._lineHistoryView == null) {
this._context.subscriptions.push((this._lineHistoryView = new LineHistoryView()));
}
@ -249,7 +262,7 @@ export class Container {
private static _rebaseEditor: RebaseEditorProvider | undefined;
static get rebaseEditor() {
if (this._rebaseEditor === undefined) {
if (this._rebaseEditor == null) {
this._context.subscriptions.push((this._rebaseEditor = new RebaseEditorProvider()));
}
@ -258,7 +271,7 @@ export class Container {
private static _remotesView: RemotesView | undefined;
static get remotesView() {
if (this._remotesView === undefined) {
if (this._remotesView == null) {
this._context.subscriptions.push((this._remotesView = new RemotesView()));
}
@ -267,7 +280,7 @@ export class Container {
private static _repositoriesView: RepositoriesView | undefined;
static get repositoriesView(): RepositoriesView {
if (this._repositoriesView === undefined) {
if (this._repositoriesView == null) {
this._context.subscriptions.push((this._repositoriesView = new RepositoriesView()));
}
@ -276,7 +289,7 @@ export class Container {
private static _searchAndCompareView: SearchAndCompareView | undefined;
static get searchAndCompareView() {
if (this._searchAndCompareView === undefined) {
if (this._searchAndCompareView == null) {
this._context.subscriptions.push((this._searchAndCompareView = new SearchAndCompareView()));
}
@ -290,7 +303,7 @@ export class Container {
private static _stashesView: StashesView | undefined;
static get stashesView() {
if (this._stashesView === undefined) {
if (this._stashesView == null) {
this._context.subscriptions.push((this._stashesView = new StashesView()));
}
@ -304,7 +317,7 @@ export class Container {
private static _tagsView: TagsView | undefined;
static get tagsView() {
if (this._tagsView === undefined) {
if (this._tagsView == null) {
this._context.subscriptions.push((this._tagsView = new TagsView()));
}
@ -318,7 +331,7 @@ export class Container {
private static _viewCommands: ViewCommands | undefined;
static get viewCommands() {
if (this._viewCommands === undefined) {
if (this._viewCommands == null) {
this._viewCommands = new ViewCommands();
}
return this._viewCommands;
@ -386,7 +399,7 @@ export class Container {
}
private static applyModeConfigurationTransform(e: ConfigurationChangeEvent): ConfigurationChangeEvent {
if (this._configsAffectedByMode === undefined) {
if (this._configsAffectedByMode == null) {
this._configsAffectedByMode = [
`gitlens.${configuration.name('mode')}`,
`gitlens.${configuration.name('modes')}`,

+ 9
- 4
src/extension.ts 查看文件

@ -1,6 +1,8 @@
'use strict';
import * as paths from 'path';
import { commands, ExtensionContext, extensions, window, workspace } from 'vscode';
import { Api } from './api/api';
import { GitLensApi } from './api/gitlens';
import { Commands, registerCommands } from './commands';
import { configuration, Configuration } from './configuration';
import { ContextKeys, GlobalState, GlyphChars, setContext, SyncedState } from './constants';
@ -15,7 +17,7 @@ import { ViewNode } from './views/nodes';
let _context: ExtensionContext | undefined;
export async function activate(context: ExtensionContext) {
export async function activate(context: ExtensionContext): Promise<GitLensApi | undefined> {
const start = process.hrtime();
_context = context;
@ -31,7 +33,7 @@ export async function activate(context: ExtensionContext) {
void Messages.showInsidersErrorMessage();
return;
return undefined;
}
}
@ -105,7 +107,7 @@ export async function activate(context: ExtensionContext) {
void Messages.showGitDisabledErrorMessage();
return;
return undefined;
}
Configuration.configure(context);
@ -127,7 +129,7 @@ export async function activate(context: ExtensionContext) {
);
}
return;
return undefined;
}
Container.initialize(extensionId, context, cfg);
@ -151,6 +153,9 @@ export async function activate(context: ExtensionContext) {
GlyphChars.Dot
} ${Strings.getDurationMilliseconds(start)} ms`,
);
const api = new Api();
return api;
}
export function deactivate() {

+ 16
- 0
src/git/models/models.ts 查看文件

@ -206,6 +206,22 @@ export namespace GitReference {
}
}
export function fromBranch(branch: GitBranchReference) {
return create(branch.ref, branch.repoPath, {
refType: branch.refType,
name: branch.name,
remote: branch.remote,
tracking: branch.tracking,
});
}
export function fromTag(tag: GitTagReference) {
return create(tag.ref, tag.repoPath, {
refType: tag.refType,
name: tag.name,
});
}
export function getNameWithoutRemote(ref: GitReference) {
if (ref.refType === 'branch') {
return ref.remote ? GitBranch.getNameWithoutRemote(ref.name) : ref.name;

+ 15
- 0
src/git/models/remote.ts 查看文件

@ -63,6 +63,21 @@ export class GitRemote
return this.id === defaultRemote;
}
get url(): string | undefined {
let url;
for (const remoteUrl of this.urls) {
if (remoteUrl.type === GitRemoteType.Push) {
return remoteUrl.url;
}
if (url == null) {
url = remoteUrl.url;
}
}
return url;
}
async setAsDefault(state: boolean = true, updateViews: boolean = true) {
void (await Container.context.workspaceState.update(WorkspaceState.DefaultRemote, state ? this.id : undefined));

+ 44
- 0
src/views/viewCommands.ts 查看文件

@ -1,10 +1,12 @@
'use strict';
import { commands, env, TextDocumentShowOptions, Uri, window } from 'vscode';
import { CreatePullRequestActionContext, OpenPullRequestActionContext } from '../api/gitlens';
import {
Commands,
DiffWithCommandArgs,
DiffWithPreviousCommandArgs,
DiffWithWorkingCommandArgs,
executeActionCommand,
executeCommand,
executeEditorCommand,
GitActions,
@ -29,6 +31,7 @@ import {
nodeSupportsClearing,
PageableViewNode,
PagerNode,
PullRequestNode,
RemoteNode,
RepositoryNode,
ResultsFileNode,
@ -198,6 +201,9 @@ export class ViewCommands {
commands.registerCommand('gitlens.views.undoCommit', this.undoCommit, this);
commands.registerCommand('gitlens.views.terminalRemoveRemote', this.terminalRemoveRemote, this);
commands.registerCommand('gitlens.views.createPullRequest', this.createPullRequest, this);
commands.registerCommand('gitlens.views.openPullRequest', this.openPullRequest, this);
}
@debug()
@ -258,6 +264,30 @@ export class ViewCommands {
}
@debug()
private async createPullRequest(node: BranchNode | BranchTrackingStatusNode) {
if (!(node instanceof BranchNode) && !(node instanceof BranchTrackingStatusNode)) {
return Promise.resolve();
}
const remote = await node.branch.getRemote();
return executeActionCommand<CreatePullRequestActionContext>('createPullRequest', {
branch: {
name: node.branch.name,
remote:
remote != null
? {
name: remote.name,
provider: remote.provider?.name,
url: remote.url,
}
: undefined,
repoPath: node.repoPath,
},
});
}
@debug()
private createTag(node?: ViewRefNode) {
if (node != null && !(node instanceof ViewRefNode)) return Promise.resolve();
@ -354,6 +384,20 @@ export class ViewCommands {
}
@debug()
private openPullRequest(node: PullRequestNode) {
if (!(node instanceof PullRequestNode)) return Promise.resolve();
return executeActionCommand<OpenPullRequestActionContext>('openPullRequest', {
pullRequest: {
id: node.pullRequest.id,
provider: node.pullRequest.provider,
repoPath: node.uri.repoPath!,
url: node.pullRequest.url,
},
});
}
@debug()
private openInTerminal(node: RepositoryNode) {
if (!(node instanceof RepositoryNode)) return Promise.resolve();

+ 23
- 0
test/extension.test.ts 查看文件

@ -19,3 +19,26 @@ suite('Extension Tests', () => {
assert.equal(-1, [1, 2, 3].indexOf(0));
});
});
// import { CreatePullRequestActionContext, OpenPullRequestActionContext } from '../src/api/gitlens';
// api.registerActionRunner('openPullRequest', {
// label: 'Test Runner',
// run: function (context: OpenPullRequestActionContext) {
// console.log(context);
// },
// });
// api.registerActionRunner('createPullRequest', {
// label: 'Test Runner 1',
// run: function (context: CreatePullRequestActionContext) {
// console.log('Test Runner 1', context);
// },
// });
// api.registerActionRunner('createPullRequest', {
// label: 'Test Runner 2',
// run: function (context: CreatePullRequestActionContext) {
// console.log('Test Runner 2', context);
// },
// });

Loading…
取消
儲存