Skip to content

Commit 4570b30

Browse files
committed
feat: add type and add return
1 parent f64238f commit 4570b30

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/extension.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@ function _validateFoundRepos(git: API) {
2828

2929
/**
3030
* Run autofill against one of multiples in the workspace or when using GitLens on a single repo.
31-
*
32-
* @param sourceControl Of type `vscode.SourceControl` with public `.rootUri`
33-
* and private `._rootUri` (the latter is not set when using GitLens).
3431
*/
35-
async function _handleRepos(git: API, sourceControl: any) {
32+
async function _handleRepos(git: API, sourceControl: vscode.SourceControl) {
3633
// FIXME: Unfortunately this seems to only pick up the first repo and not find
37-
// second, etc.
34+
// second, etc. If you repository through to makeAndFillCommitMsg, getChanges
35+
// and diffIndex etc. and replace "getWorkspaceFolder" usage then that will work.
3836
const selectedRepo = git.repositories.find(repository => {
3937
const uri = sourceControl.rootUri;
4038
if (!uri) {
41-
console.warn("rootUri not set on VS Code source control");
39+
console.warn("rootUri not set for current repo");
40+
return false;
4241
}
4342
return repository.rootUri.path === uri.path;
4443
});
@@ -61,14 +60,14 @@ async function _handleRepo(git: API) {
6160
/**
6261
* Choose the relevant repo and apply autofill logic on files there.
6362
*/
64-
async function _chooseRepoForAutofill(uri?: vscode.Uri) {
63+
async function _chooseRepoForAutofill(sourceControl?: vscode.SourceControl) {
6564
const git = getGitExtension()!;
6665
_validateFoundRepos(git);
6766

6867
vscode.commands.executeCommand("workbench.view.scm");
6968

70-
if (uri) {
71-
_handleRepos(git, uri);
69+
if (sourceControl) {
70+
_handleRepos(git, sourceControl);
7271
} else {
7372
_handleRepo(git);
7473
}

0 commit comments

Comments
 (0)