diff --git a/package.json b/package.json index 300bd54..eda2a75 100644 --- a/package.json +++ b/package.json @@ -730,5 +730,6 @@ "date-fns": "^2.16.1", "jsonc-parser": "^3.0.0", "which": "^3.0.0" - } + }, + "extensionDependencies": ["vscode.git"] } diff --git a/src/utils/commitCache.ts b/src/utils/commitCache.ts index 1e724ec..203e8c5 100644 --- a/src/utils/commitCache.ts +++ b/src/utils/commitCache.ts @@ -1,12 +1,12 @@ import { Commit, Repository } from '../typings/git'; -const commitCache: { [hash: string]: Promise; } = {}; +const commitCache: { [hash: string]: Promise | undefined; } = {}; export function getCommit(repository: Repository, hash: string): Promise { - //@ts-expect-error TS2801 - if (commitCache[hash]) { - return commitCache[hash]; + let cachedResult = commitCache[hash]; + if (cachedResult !== undefined) { + return cachedResult; } const commitTask = repository.getCommit(hash); diff --git a/src/utils/viewUtils.ts b/src/utils/viewUtils.ts index a649dea..bb1911e 100644 --- a/src/utils/viewUtils.ts +++ b/src/utils/viewUtils.ts @@ -27,13 +27,13 @@ export default class ViewUtils { } public static showDocumentColumn(): ViewColumn { - const activeColumn = window.activeTextEditor?.viewColumn ?? 0; + const activeColumn = window.activeTextEditor?.viewColumn; - if (magitConfig.displayBufferSameColumn) { + if (activeColumn && magitConfig.displayBufferSameColumn) { return activeColumn; } - if (activeColumn > ViewColumn.One) { + if ((activeColumn ?? 0) > ViewColumn.One) { return ViewColumn.One; } return ViewColumn.Two;