Skip to content

Commit 3e66c43

Browse files
committed
🐞fix(插件入口): 修复issue #13 #14
1 parent bbdd7d2 commit 3e66c43

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/extension.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function activate(context: vscode.ExtensionContext) {
4949
}
5050

5151
//获取当前的 git仓库实例 Get git repo instance
52-
const repo = gitExtension?.getAPI(1).repositories[0];
52+
let repo: any = gitExtension.getAPI(1).repositories[0];
5353
//输入提交详情 Input message detail
5454
const inputMessageDetail = (_key: string | number) => {
5555
const _detailType = CommitDetailType.find((item) => item.key === _key);
@@ -116,7 +116,13 @@ export function activate(context: vscode.ExtensionContext) {
116116
});
117117
};
118118
//点击图标触发快捷选项 Click the icon to trigger shortcut options
119-
let disposable = vscode.commands.registerCommand('extension.showGitCommit', () => {
119+
let disposable = vscode.commands.registerCommand('extension.showGitCommit', (uri?) => {
120+
if (uri) {
121+
//如果有多个repo 寻找当前的 进行填充 If there are multiple repos looking for the current to populate
122+
repo = gitExtension.getAPI(1).repositories.find((repo) => {
123+
return repo.rootUri.path === uri._rootUri.path;
124+
});
125+
}
120126
startMessageInput();
121127
});
122128
context.subscriptions.push(disposable);

0 commit comments

Comments
 (0)