Skip to content

Commit 54aa311

Browse files
committed
feat: optimize code
1 parent 93c71a3 commit 54aa311

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/init.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@ import { getMRUrl } from './utils/repo';
77
import ACTIONS, { dispatch } from './utils/actions';
88
import { IDepot, IMRItem } from './typings/common';
99

10+
const { registerCommand } = hx.commands;
11+
1012
export function registerCommands(context: IContext) {
1113
const { codingServer } = context;
1214

1315
context.subscriptions.push(
14-
hx.commands.registerCommand('codingPlugin.helloWorld', () => {
16+
registerCommand('codingPlugin.helloWorld', () => {
1517
toast.info('hello');
1618
}),
1719
);
1820

1921
context.subscriptions.push(
20-
hx.commands.registerCommand('codingPlugin.mrTreeItemClick', function ([team, mrItem]: [string, IMRItem]) {
22+
registerCommand('codingPlugin.mrTreeItemClick', function ([team, mrItem]: [string, IMRItem]) {
2123
hx.env.openExternal(getMRUrl(team, mrItem));
2224
}),
2325
);
2426

2527
context.subscriptions.push(
26-
hx.commands.registerCommand('codingPlugin.depotTreeItemClick', function (param: IDepot) {
28+
registerCommand('codingPlugin.depotTreeItemClick', function (param: IDepot) {
2729
toast.info(`选中仓库:${param.name}`);
2830
dispatch(ACTIONS.SET_SELECTED_DEPOT, {
2931
context,
@@ -33,7 +35,7 @@ export function registerCommands(context: IContext) {
3335
);
3436

3537
context.subscriptions.push(
36-
hx.commands.registerCommand('codingPlugin.createDepot', async function (param: any) {
38+
registerCommand('codingPlugin.createDepot', async function (param: any) {
3739
const depot = await hx.window.showInputBox({
3840
prompt: '请输入仓库名',
3941
});

0 commit comments

Comments
 (0)