Browse Source

Improves logging type-safety

main
Eric Amodio 3 years ago
parent
commit
fae7449a0b
15 changed files with 146 additions and 300 deletions
  1. +9
    -8
      src/annotations/autolinks.ts
  2. +36
    -97
      src/git/gitProviderService.ts
  3. +23
    -72
      src/git/providers/localGitProvider.ts
  4. +6
    -36
      src/github/github.ts
  5. +11
    -10
      src/hovers/lineHoverController.ts
  6. +2
    -2
      src/statusbar/statusBarController.ts
  7. +27
    -8
      src/system/decorators/log.ts
  8. +10
    -15
      src/trackers/gitLineTracker.ts
  9. +2
    -2
      src/views/nodes/lineHistoryTrackerNode.ts
  10. +3
    -7
      src/views/nodes/repositoryNode.ts
  11. +1
    -5
      src/views/nodes/viewNode.ts
  12. +1
    -3
      src/views/searchAndCompareView.ts
  13. +12
    -24
      src/views/viewBase.ts
  14. +2
    -10
      src/vsls/vsls.ts
  15. +1
    -1
      src/webviews/rebaseEditor.ts

+ 9
- 8
src/annotations/autolinks.ts View File

@ -47,11 +47,11 @@ export class Autolinks implements Disposable {
} }
} }
@debug({
@debug<Autolinks['getIssueOrPullRequestLinks']>({
args: { args: {
0: (message: string) => message.substring(0, 50),
1: _ => false,
2: ({ timeout }) => timeout,
0: message => message.substring(0, 50),
1: false,
2: options => options?.timeout,
}, },
}) })
async getIssueOrPullRequestLinks(message: string, remote: GitRemote, { timeout }: { timeout?: number } = {}) { async getIssueOrPullRequestLinks(message: string, remote: GitRemote, { timeout }: { timeout?: number } = {}) {
@ -101,11 +101,12 @@ export class Autolinks implements Disposable {
return issuesOrPullRequests; return issuesOrPullRequests;
} }
@debug({
@debug<Autolinks['linkify']>({
args: { args: {
0: (text: string) => text.substring(0, 30),
2: _ => false,
3: _ => false,
0: text => text.substring(0, 30),
2: remotes => remotes?.length,
3: issuesOrPullRequests => issuesOrPullRequests?.size,
4: footnotes => footnotes?.size,
}, },
}) })
linkify( linkify(

+ 36
- 97
src/git/gitProviderService.ts View File

@ -163,7 +163,7 @@ export class GitProviderService implements Disposable {
} }
} }
@debug()
@debug<GitProviderService['onWindowStateChanged']>({ args: { 0: e => `focused=${e.focused}` } })
private onWindowStateChanged(e: WindowState) { private onWindowStateChanged(e: WindowState) {
if (e.focused) { if (e.focused) {
this._repositories.forEach(r => r.resume()); this._repositories.forEach(r => r.resume());
@ -268,7 +268,7 @@ export class GitProviderService implements Disposable {
* @param provider A provider for handling git operations * @param provider A provider for handling git operations
* @returns A disposable to unregister the {@link GitProvider} * @returns A disposable to unregister the {@link GitProvider}
*/ */
@log({ args: { 1: () => false }, singleLine: true })
@log({ args: { 1: false }, singleLine: true })
register(id: GitProviderId, provider: GitProvider): Disposable { register(id: GitProviderId, provider: GitProvider): Disposable {
if (this._providers.has(id)) throw new Error(`Provider '${id}' has already been registered`); if (this._providers.has(id)) throw new Error(`Provider '${id}' has already been registered`);
@ -364,7 +364,7 @@ export class GitProviderService implements Disposable {
private _discoveredWorkspaceFolders = new Map<WorkspaceFolder, Promise<Repository[]>>(); private _discoveredWorkspaceFolders = new Map<WorkspaceFolder, Promise<Repository[]>>();
@log<GitProviderService['discoverRepositories']>({ args: { 0: folders => `${folders.length}` } })
@log<GitProviderService['discoverRepositories']>({ args: { 0: folders => folders.length } })
async discoverRepositories(folders: readonly WorkspaceFolder[], options?: { force?: boolean }): Promise<void> { async discoverRepositories(folders: readonly WorkspaceFolder[], options?: { force?: boolean }): Promise<void> {
const promises = []; const promises = [];
@ -587,12 +587,7 @@ export class GitProviderService implements Disposable {
void Promise.allSettled([...this._providers.values()].map(provider => provider.resetCaches(...cache))); void Promise.allSettled([...this._providers.values()].map(provider => provider.resetCaches(...cache)));
} }
@log({
args: {
0: (repoPath: string) => repoPath,
1: (uris: Uri[]) => `${uris.length}`,
},
})
@log<GitProviderService['excludeIgnoredUris']>({ args: { 1: uris => uris.length } })
async excludeIgnoredUris(repoPath: string, uris: Uri[]): Promise<Uri[]> { async excludeIgnoredUris(repoPath: string, uris: Uri[]): Promise<Uri[]> {
const { provider, path } = this.getProvider(repoPath); const { provider, path } = this.getProvider(repoPath);
return provider.excludeIgnoredUris(path, uris); return provider.excludeIgnoredUris(path, uris);
@ -611,11 +606,7 @@ export class GitProviderService implements Disposable {
@gate<GitProviderService['fetchAll']>( @gate<GitProviderService['fetchAll']>(
(repos, opts) => `${repos == null ? '' : repos.map(r => r.id).join(',')}|${JSON.stringify(opts)}`, (repos, opts) => `${repos == null ? '' : repos.map(r => r.id).join(',')}|${JSON.stringify(opts)}`,
) )
@log({
args: {
0: (repos?: Repository[]) => (repos == null ? false : repos.map(r => r.name).join(', ')),
},
})
@log<GitProviderService['fetchAll']>({ args: { 0: repos => repos?.map(r => r.name).join(', ') } })
async fetchAll(repositories?: Repository[], options?: { all?: boolean; prune?: boolean }) { async fetchAll(repositories?: Repository[], options?: { all?: boolean; prune?: boolean }) {
if (repositories == null) { if (repositories == null) {
repositories = this.openRepositories; repositories = this.openRepositories;
@ -640,11 +631,7 @@ export class GitProviderService implements Disposable {
@gate<GitProviderService['pullAll']>( @gate<GitProviderService['pullAll']>(
(repos, opts) => `${repos == null ? '' : repos.map(r => r.id).join(',')}|${JSON.stringify(opts)}`, (repos, opts) => `${repos == null ? '' : repos.map(r => r.id).join(',')}|${JSON.stringify(opts)}`,
) )
@log({
args: {
0: (repos?: Repository[]) => (repos == null ? false : repos.map(r => r.name).join(', ')),
},
})
@log<GitProviderService['pullAll']>({ args: { 0: repos => repos?.map(r => r.name).join(', ') } })
async pullAll(repositories?: Repository[], options?: { rebase?: boolean }) { async pullAll(repositories?: Repository[], options?: { rebase?: boolean }) {
if (repositories == null) { if (repositories == null) {
repositories = this.openRepositories; repositories = this.openRepositories;
@ -667,11 +654,7 @@ export class GitProviderService implements Disposable {
} }
@gate<GitProviderService['pushAll']>(repos => `${repos == null ? '' : repos.map(r => r.id).join(',')}`) @gate<GitProviderService['pushAll']>(repos => `${repos == null ? '' : repos.map(r => r.id).join(',')}`)
@log({
args: {
0: (repos?: Repository[]) => (repos == null ? false : repos.map(r => r.name).join(', ')),
},
})
@log<GitProviderService['pushAll']>({ args: { 0: repos => repos?.map(r => r.name).join(', ') } })
async pushAll( async pushAll(
repositories?: Repository[], repositories?: Repository[],
options?: { options?: {
@ -702,11 +685,8 @@ export class GitProviderService implements Disposable {
); );
} }
@log({
args: {
0: (editor: TextEditor) =>
editor != null ? `TextEditor(${Logger.toLoggable(editor.document.uri)})` : 'undefined',
},
@log<GitProviderService['getActiveRepository']>({
args: { 0: e => (e != null ? `TextEditor(${Logger.toLoggable(e.document.uri)})` : undefined) },
}) })
async getActiveRepository(editor?: TextEditor): Promise<Repository | undefined> { async getActiveRepository(editor?: TextEditor): Promise<Repository | undefined> {
const repoPath = await this.getActiveRepoPath(editor); const repoPath = await this.getActiveRepoPath(editor);
@ -715,11 +695,8 @@ export class GitProviderService implements Disposable {
return this.getRepository(repoPath); return this.getRepository(repoPath);
} }
@log({
args: {
0: (editor: TextEditor) =>
editor != null ? `TextEditor(${Logger.toLoggable(editor.document.uri)})` : 'undefined',
},
@log<GitProviderService['getActiveRepoPath']>({
args: { 0: e => (e != null ? `TextEditor(${Logger.toLoggable(e.document.uri)})` : undefined) },
}) })
async getActiveRepoPath(editor?: TextEditor): Promise<string | undefined> { async getActiveRepoPath(editor?: TextEditor): Promise<string | undefined> {
editor = editor ?? window.activeTextEditor; editor = editor ?? window.activeTextEditor;
@ -743,11 +720,7 @@ export class GitProviderService implements Disposable {
return provider.getBlameForFile(uri); return provider.getBlameForFile(uri);
} }
@log({
args: {
1: _contents => '<contents>',
},
})
@log<GitProviderService['getBlameForFileContents']>({ args: { 1: '<contents>' } })
async getBlameForFileContents(uri: GitUri, contents: string): Promise<GitBlame | undefined> { async getBlameForFileContents(uri: GitUri, contents: string): Promise<GitBlame | undefined> {
const { provider } = this.getProvider(uri); const { provider } = this.getProvider(uri);
return provider.getBlameForFileContents(uri, contents); return provider.getBlameForFileContents(uri, contents);
@ -763,11 +736,7 @@ export class GitProviderService implements Disposable {
return provider.getBlameForLine(uri, editorLine, options); return provider.getBlameForLine(uri, editorLine, options);
} }
@log({
args: {
2: _contents => '<contents>',
},
})
@log<GitProviderService['getBlameForLineContents']>({ args: { 2: '<contents>' } })
async getBlameForLineContents( async getBlameForLineContents(
uri: GitUri, uri: GitUri,
editorLine: number, // editor lines are 0-based editorLine: number, // editor lines are 0-based
@ -784,21 +753,13 @@ export class GitProviderService implements Disposable {
return provider.getBlameForRange(uri, range); return provider.getBlameForRange(uri, range);
} }
@log({
args: {
2: _contents => '<contents>',
},
})
@log<GitProviderService['getBlameForRangeContents']>({ args: { 2: '<contents>' } })
async getBlameForRangeContents(uri: GitUri, range: Range, contents: string): Promise<GitBlameLines | undefined> { async getBlameForRangeContents(uri: GitUri, range: Range, contents: string): Promise<GitBlameLines | undefined> {
const { provider } = this.getProvider(uri); const { provider } = this.getProvider(uri);
return provider.getBlameForRangeContents(uri, range, contents); return provider.getBlameForRangeContents(uri, range, contents);
} }
@log({
args: {
0: _blame => '<blame>',
},
})
@log<GitProviderService['getBlameForRangeSync']>({ args: { 0: '<blame>' } })
getBlameForRangeSync(blame: GitBlame, uri: GitUri, range: Range): GitBlameLines | undefined { getBlameForRangeSync(blame: GitBlame, uri: GitUri, range: Range): GitBlameLines | undefined {
const { provider } = this.getProvider(uri); const { provider } = this.getProvider(uri);
return provider.getBlameForRangeSync(blame, uri, range); return provider.getBlameForRangeSync(blame, uri, range);
@ -812,11 +773,7 @@ export class GitProviderService implements Disposable {
return provider.getBranch(path); return provider.getBranch(path);
} }
@log({
args: {
0: b => b.name,
},
})
@log<GitProviderService['getBranchAheadRange']>({ args: { 0: b => b.name } })
async getBranchAheadRange(branch: GitBranch): Promise<string | undefined> { async getBranchAheadRange(branch: GitBranch): Promise<string | undefined> {
if (branch.state.ahead > 0) { if (branch.state.ahead > 0) {
return GitRevision.createRange(branch.upstream?.name, branch.ref); return GitRevision.createRange(branch.upstream?.name, branch.ref);
@ -848,11 +805,7 @@ export class GitProviderService implements Disposable {
return undefined; return undefined;
} }
@log({
args: {
1: () => false,
},
})
@log({ args: { 1: false } })
async getBranches( async getBranches(
repoPath: string | Uri | undefined, repoPath: string | Uri | undefined,
options?: { options?: {
@ -945,7 +898,7 @@ export class GitProviderService implements Disposable {
return provider.getCommitBranches(path, ref, options); return provider.getCommitBranches(path, ref, options);
} }
@log()
@log<GitProviderService['getAheadBehindCommitCount']>({ args: { 1: refs => refs.join(',') } })
getAheadBehindCommitCount( getAheadBehindCommitCount(
repoPath: string | Uri, repoPath: string | Uri,
refs: string[], refs: string[],
@ -1022,11 +975,7 @@ export class GitProviderService implements Disposable {
return provider.getDiffForFile(uri, ref1, ref2, originalFileName); return provider.getDiffForFile(uri, ref1, ref2, originalFileName);
} }
@log({
args: {
1: _contents => '<contents>',
},
})
@log<GitProviderService['getDiffForFileContents']>({ args: { 1: '<contents>' } })
async getDiffForFileContents( async getDiffForFileContents(
uri: GitUri, uri: GitUri,
ref: string, ref: string,
@ -1248,11 +1197,7 @@ export class GitProviderService implements Disposable {
options != null ? `|${options.limit ?? -1}:${options.include?.join(',')}` : '' options != null ? `|${options.limit ?? -1}:${options.include?.join(',')}` : ''
}`; }`;
}) })
@debug<GitProviderService['getPullRequestForBranch']>({
args: {
1: (remoteOrProvider: GitRemote | RichRemoteProvider) => remoteOrProvider.name,
},
})
@debug<GitProviderService['getPullRequestForBranch']>({ args: { 1: remoteOrProvider => remoteOrProvider.name } })
async getPullRequestForBranch( async getPullRequestForBranch(
branch: string, branch: string,
remoteOrProvider: GitRemote | RichRemoteProvider, remoteOrProvider: GitRemote | RichRemoteProvider,
@ -1305,11 +1250,7 @@ export class GitProviderService implements Disposable {
options?.timeout options?.timeout
}`; }`;
}) })
@debug<GitProviderService['getPullRequestForCommit']>({
args: {
1: (remoteOrProvider: GitRemote | RichRemoteProvider) => remoteOrProvider.name,
},
})
@debug<GitProviderService['getPullRequestForCommit']>({ args: { 1: remoteOrProvider => remoteOrProvider.name } })
async getPullRequestForCommit( async getPullRequestForCommit(
ref: string, ref: string,
remoteOrProvider: GitRemote | RichRemoteProvider, remoteOrProvider: GitRemote | RichRemoteProvider,
@ -1368,7 +1309,12 @@ export class GitProviderService implements Disposable {
options?.includeDisconnected ?? false options?.includeDisconnected ?? false
}`, }`,
) )
@log({ args: { 0: () => false } })
@log<GitProviderService['getRichRemoteProvider']>({
args: {
0: remotesOrRepoPath =>
Array.isArray(remotesOrRepoPath) ? remotesOrRepoPath.map(r => r.name).join(',') : remotesOrRepoPath,
},
})
async getRichRemoteProvider( async getRichRemoteProvider(
remotesOrRepoPath: GitRemote[] | string | Uri | undefined, remotesOrRepoPath: GitRemote[] | string | Uri | undefined,
options?: { includeDisconnected?: boolean }, options?: { includeDisconnected?: boolean },
@ -1412,9 +1358,7 @@ export class GitProviderService implements Disposable {
async getRepoPath(filePath: string, options?: { ref?: string }): Promise<string | undefined>; async getRepoPath(filePath: string, options?: { ref?: string }): Promise<string | undefined>;
async getRepoPath(uri: Uri | undefined, options?: { ref?: string }): Promise<string | undefined>; async getRepoPath(uri: Uri | undefined, options?: { ref?: string }): Promise<string | undefined>;
@log<GitProviderService['getRepoPath']>({
exit: path => `returned ${path}`,
})
@log<GitProviderService['getRepoPath']>({ exit: path => `returned ${path}` })
async getRepoPath( async getRepoPath(
filePathOrUri: string | Uri | undefined, filePathOrUri: string | Uri | undefined,
options?: { ref?: string }, options?: { ref?: string },
@ -1474,7 +1418,9 @@ export class GitProviderService implements Disposable {
return rp; return rp;
} }
@log()
@log<GitProviderService['getRepoPathOrActive']>({
args: { 1: e => (e != null ? `TextEditor(${Logger.toLoggable(e.document.uri)})` : undefined) },
})
async getRepoPathOrActive(uri: Uri | undefined, editor: TextEditor | undefined) { async getRepoPathOrActive(uri: Uri | undefined, editor: TextEditor | undefined) {
const repoPath = await this.getRepoPath(uri); const repoPath = await this.getRepoPath(uri);
if (repoPath) return repoPath; if (repoPath) return repoPath;
@ -1601,11 +1547,7 @@ export class GitProviderService implements Disposable {
return provider.getStatusForRepo(path); return provider.getStatusForRepo(path);
} }
@log({
args: {
1: () => false,
},
})
@log({ args: { 1: false } })
async getTags( async getTags(
repoPath: string | Uri | undefined, repoPath: string | Uri | undefined,
options?: { filter?: (t: GitTag) => boolean; sort?: boolean | TagSortOptions }, options?: { filter?: (t: GitTag) => boolean; sort?: boolean | TagSortOptions },
@ -1660,7 +1602,7 @@ export class GitProviderService implements Disposable {
return provider.getWorkingUri(path, uri); return provider.getWorkingUri(path, uri);
} }
@log()
@log({ args: { 1: false } })
async hasBranchOrTag( async hasBranchOrTag(
repoPath: string | Uri | undefined, repoPath: string | Uri | undefined,
options?: { options?: {
@ -1693,11 +1635,8 @@ export class GitProviderService implements Disposable {
return repository.hasUpstreamBranch(); return repository.hasUpstreamBranch();
} }
@log({
args: {
1: (editor: TextEditor) =>
editor != null ? `TextEditor(${Logger.toLoggable(editor.document.uri)})` : 'undefined',
},
@log<GitProviderService['isActiveRepoPath']>({
args: { 1: e => (e != null ? `TextEditor(${Logger.toLoggable(e.document.uri)})` : undefined) },
}) })
async isActiveRepoPath(repoPath: string | undefined, editor?: TextEditor): Promise<boolean> { async isActiveRepoPath(repoPath: string | undefined, editor?: TextEditor): Promise<boolean> {
if (repoPath == null) return false; if (repoPath == null) return false;
@ -1830,7 +1769,7 @@ export class GitProviderService implements Disposable {
return provider.stashDelete(path, stashName, ref); return provider.stashDelete(path, stashName, ref);
} }
@log()
@log<GitProviderService['stashSave']>({ args: { 2: uris => uris?.length } })
stashSave( stashSave(
repoPath: string | Uri, repoPath: string | Uri,
message?: string, message?: string,

+ 23
- 72
src/git/providers/localGitProvider.ts View File

@ -396,14 +396,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
return repositories; return repositories;
} }
@debug({
args: {
0: (root: string) => root,
1: (depth: number) => `${depth}`,
2: () => false,
3: () => false,
},
})
@debug<LocalGitProvider['repositorySearchCore']>({ args: { 2: false, 3: false } })
private repositorySearchCore( private repositorySearchCore(
root: string, root: string,
depth: number, depth: number,
@ -564,12 +557,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
} }
} }
@log({
args: {
0: (repoPath: string) => repoPath,
1: (uris: Uri[]) => `${uris.length}`,
},
})
@log<LocalGitProvider['excludeIgnoredUris']>({ args: { 1: uris => uris.length } })
async excludeIgnoredUris(repoPath: string, uris: Uri[]): Promise<Uri[]> { async excludeIgnoredUris(repoPath: string, uris: Uri[]): Promise<Uri[]> {
const paths = new Map<string, Uri>(uris.map(u => [Strings.normalizePath(u.fsPath), u])); const paths = new Map<string, Uri>(uris.map(u => [Strings.normalizePath(u.fsPath), u]));
@ -690,11 +678,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
} }
} }
@log({
args: {
1: _contents => '<contents>',
},
})
@log<LocalGitProvider['getBlameForFileContents']>({ args: { 1: '<contents>' } })
async getBlameForFileContents(uri: GitUri, contents: string): Promise<GitBlame | undefined> { async getBlameForFileContents(uri: GitUri, contents: string): Promise<GitBlame | undefined> {
const cc = Logger.getCorrelationContext(); const cc = Logger.getCorrelationContext();
@ -823,11 +807,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
} }
} }
@log({
args: {
2: _contents => '<contents>',
},
})
@log<LocalGitProvider['getBlameForLineContents']>({ args: { 2: '<contents>' } })
async getBlameForLineContents( async getBlameForLineContents(
uri: GitUri, uri: GitUri,
editorLine: number, // editor lines are 0-based editorLine: number, // editor lines are 0-based
@ -886,11 +866,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
return this.getBlameForRangeSync(blame, uri, range); return this.getBlameForRangeSync(blame, uri, range);
} }
@log({
args: {
2: _contents => '<contents>',
},
})
@log<LocalGitProvider['getBlameForRangeContents']>({ args: { 2: '<contents>' } })
async getBlameForRangeContents(uri: GitUri, range: Range, contents: string): Promise<GitBlameLines | undefined> { async getBlameForRangeContents(uri: GitUri, range: Range, contents: string): Promise<GitBlameLines | undefined> {
const blame = await this.getBlameForFileContents(uri, contents); const blame = await this.getBlameForFileContents(uri, contents);
if (blame == null) return undefined; if (blame == null) return undefined;
@ -898,11 +874,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
return this.getBlameForRangeSync(blame, uri, range); return this.getBlameForRangeSync(blame, uri, range);
} }
@log({
args: {
0: _blame => '<blame>',
},
})
@log<LocalGitProvider['getBlameForRangeContents']>({ args: { 0: '<blame>' } })
getBlameForRangeSync(blame: GitBlame, uri: GitUri, range: Range): GitBlameLines | undefined { getBlameForRangeSync(blame: GitBlame, uri: GitUri, range: Range): GitBlameLines | undefined {
if (blame.lines.length === 0) return { allLines: blame.lines, ...blame }; if (blame.lines.length === 0) return { allLines: blame.lines, ...blame };
@ -1021,11 +993,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
// return undefined; // return undefined;
// } // }
@log({
args: {
1: () => false,
},
})
@log({ args: { 1: false } })
async getBranches( async getBranches(
repoPath: string | undefined, repoPath: string | undefined,
options: { options: {
@ -1188,7 +1156,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
.filter(<T>(i?: T): i is T => Boolean(i)); .filter(<T>(i?: T): i is T => Boolean(i));
} }
@log()
@log<LocalGitProvider['getAheadBehindCommitCount']>({ args: { 1: refs => refs.join(',') } })
getAheadBehindCommitCount( getAheadBehindCommitCount(
repoPath: string, repoPath: string,
refs: string[], refs: string[],
@ -1472,11 +1440,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
} }
} }
@log({
args: {
1: _contents => '<contents>',
},
})
@log<LocalGitProvider['getDiffForFileContents']>({ args: { 1: '<contents>' } })
async getDiffForFileContents( async getDiffForFileContents(
uri: GitUri, uri: GitUri,
ref: string, ref: string,
@ -2759,11 +2723,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
options != null ? `|${options.limit ?? -1}:${options.include?.join(',')}` : '' options != null ? `|${options.limit ?? -1}:${options.include?.join(',')}` : ''
}`; }`;
}) })
@debug<LocalGitProvider['getPullRequestForBranch']>({
args: {
1: (remoteOrProvider: GitRemote | RichRemoteProvider) => remoteOrProvider.name,
},
})
@debug<LocalGitProvider['getPullRequestForBranch']>({ args: { 1: remoteOrProvider => remoteOrProvider.name } })
async getPullRequestForBranch( async getPullRequestForBranch(
branch: string, branch: string,
remoteOrProvider: GitRemote | RichRemoteProvider, remoteOrProvider: GitRemote | RichRemoteProvider,
@ -2816,11 +2776,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
options?.timeout options?.timeout
}`; }`;
}) })
@debug<LocalGitProvider['getPullRequestForCommit']>({
args: {
1: (remoteOrProvider: GitRemote | RichRemoteProvider) => remoteOrProvider.name,
},
})
@debug<LocalGitProvider['getPullRequestForCommit']>({ args: { 1: remoteOrProvider => remoteOrProvider.name } })
async getPullRequestForCommit( async getPullRequestForCommit(
ref: string, ref: string,
remoteOrProvider: GitRemote | RichRemoteProvider, remoteOrProvider: GitRemote | RichRemoteProvider,
@ -2933,7 +2889,12 @@ export class LocalGitProvider implements GitProvider, Disposable {
options?.includeDisconnected ?? false options?.includeDisconnected ?? false
}`, }`,
) )
@log({ args: { 0: () => false } })
@log<LocalGitProvider['getRichRemoteProvider']>({
args: {
0: remotesOrRepoPath =>
Array.isArray(remotesOrRepoPath) ? remotesOrRepoPath.map(r => r.name).join(',') : remotesOrRepoPath,
},
})
async getRichRemoteProvider( async getRichRemoteProvider(
remotesOrRepoPath: GitRemote[] | string | undefined, remotesOrRepoPath: GitRemote[] | string | undefined,
{ includeDisconnected }: { includeDisconnected?: boolean } = {}, { includeDisconnected }: { includeDisconnected?: boolean } = {},
@ -3240,11 +3201,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
return status; return status;
} }
@log({
args: {
1: () => false,
},
})
@log({ args: { 1: false } })
async getTags( async getTags(
repoPath: string | undefined, repoPath: string | undefined,
options: { filter?: (t: GitTag) => boolean; sort?: boolean | TagSortOptions } = {}, options: { filter?: (t: GitTag) => boolean; sort?: boolean | TagSortOptions } = {},
@ -3382,7 +3339,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
return (await fsExists(uri.fsPath)) ? uri : undefined; return (await fsExists(uri.fsPath)) ? uri : undefined;
} }
@log()
@log({ args: { 1: false } })
async hasBranchOrTag( async hasBranchOrTag(
repoPath: string | undefined, repoPath: string | undefined,
{ {
@ -3425,11 +3382,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
return repository.hasUpstreamBranch(); return repository.hasUpstreamBranch();
} }
@log({
args: {
1: (editor: TextEditor) =>
editor != null ? `TextEditor(${Logger.toLoggable(editor.document.uri)})` : 'undefined',
},
@log<GitProviderService['isActiveRepoPath']>({
args: { 1: e => (e != null ? `TextEditor(${Logger.toLoggable(e.document.uri)})` : undefined) },
}) })
async isActiveRepoPath(repoPath: string | undefined, editor?: TextEditor): Promise<boolean> { async isActiveRepoPath(repoPath: string | undefined, editor?: TextEditor): Promise<boolean> {
if (repoPath == null) return false; if (repoPath == null) return false;
@ -3452,10 +3406,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
); );
} }
@log<LocalGitProvider['isTracked']>({
exit: tracked => `returned ${tracked}`,
singleLine: true,
})
@log<LocalGitProvider['isTracked']>({ exit: tracked => `returned ${tracked}`, singleLine: true })
async isTracked( async isTracked(
fileNameOrUri: string | GitUri, fileNameOrUri: string | GitUri,
repoPath?: string, repoPath?: string,
@ -3723,7 +3674,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
await Git.stash__delete(repoPath, stashName, ref); await Git.stash__delete(repoPath, stashName, ref);
} }
@log()
@log<LocalGitProvider['stashSave']>({ args: { 2: uris => uris?.length } })
async stashSave( async stashSave(
repoPath: string, repoPath: string,
message?: string, message?: string,

+ 6
- 36
src/github/github.ts View File

@ -14,12 +14,7 @@ import { Logger } from '../logger';
import { debug } from '../system'; import { debug } from '../system';
export class GitHubApi { export class GitHubApi {
@debug({
args: {
0: (p: RichRemoteProvider) => p.name,
1: _ => '<token>',
},
})
@debug<GitHubApi['getAccountForCommit']>({ args: { 0: p => p.name, 1: '<token>' } })
async getAccountForCommit( async getAccountForCommit(
provider: RichRemoteProvider, provider: RichRemoteProvider,
token: string, token: string,
@ -99,12 +94,7 @@ export class GitHubApi {
} }
} }
@debug({
args: {
0: (p: RichRemoteProvider) => p.name,
1: _ => '<token>',
},
})
@debug<GitHubApi['getAccountForEmail']>({ args: { 0: p => p.name, 1: '<token>' } })
async getAccountForEmail( async getAccountForEmail(
provider: RichRemoteProvider, provider: RichRemoteProvider,
token: string, token: string,
@ -178,12 +168,7 @@ export class GitHubApi {
} }
} }
@debug({
args: {
0: (p: RichRemoteProvider) => p.name,
1: _ => '<token>',
},
})
@debug<GitHubApi['getDefaultBranch']>({ args: { 0: p => p.name, 1: '<token>' } })
async getDefaultBranch( async getDefaultBranch(
provider: RichRemoteProvider, provider: RichRemoteProvider,
token: string, token: string,
@ -240,12 +225,7 @@ export class GitHubApi {
} }
} }
@debug({
args: {
0: (p: RichRemoteProvider) => p.name,
1: _ => '<token>',
},
})
@debug<GitHubApi['getIssueOrPullRequest']>({ args: { 0: p => p.name, 1: '<token>' } })
async getIssueOrPullRequest( async getIssueOrPullRequest(
provider: RichRemoteProvider, provider: RichRemoteProvider,
token: string, token: string,
@ -318,12 +298,7 @@ export class GitHubApi {
} }
} }
@debug({
args: {
0: (p: RichRemoteProvider) => p.name,
1: _ => '<token>',
},
})
@debug<GitHubApi['getPullRequestForBranch']>({ args: { 0: p => p.name, 1: '<token>' } })
async getPullRequestForBranch( async getPullRequestForBranch(
provider: RichRemoteProvider, provider: RichRemoteProvider,
token: string, token: string,
@ -429,12 +404,7 @@ export class GitHubApi {
} }
} }
@debug({
args: {
0: (p: RichRemoteProvider) => p.name,
1: _ => '<token>',
},
})
@debug<GitHubApi['getPullRequestForCommit']>({ args: { 0: p => p.name, 1: '<token>' } })
async getPullRequestForCommit( async getPullRequestForCommit(
provider: RichRemoteProvider, provider: RichRemoteProvider,
token: string, token: string,

+ 11
- 10
src/hovers/lineHoverController.ts View File

@ -15,6 +15,7 @@ import {
import { UriComparer } from '../comparers'; import { UriComparer } from '../comparers';
import { configuration, FileAnnotationType } from '../configuration'; import { configuration, FileAnnotationType } from '../configuration';
import { Container } from '../container'; import { Container } from '../container';
import { Logger } from '../logger';
import { debug } from '../system'; import { debug } from '../system';
import { LinesChangeEvent } from '../trackers/gitLineTracker'; import { LinesChangeEvent } from '../trackers/gitLineTracker';
import { Hovers } from './hovers'; import { Hovers } from './hovers';
@ -60,9 +61,9 @@ export class LineHoverController implements Disposable {
} }
} }
@debug({
@debug<LineHoverController['onActiveLinesChanged']>({
args: { args: {
0: (e: LinesChangeEvent) =>
0: e =>
`editor=${e.editor?.document.uri.toString(true)}, selections=${e.selections `editor=${e.editor?.document.uri.toString(true)}, selections=${e.selections
?.map(s => `[${s.anchor}-${s.active}]`) ?.map(s => `[${s.anchor}-${s.active}]`)
.join(',')}, pending=${Boolean(e.pending)}, reason=${e.reason}`, .join(',')}, pending=${Boolean(e.pending)}, reason=${e.reason}`,
@ -82,11 +83,11 @@ export class LineHoverController implements Disposable {
this.register(e.editor); this.register(e.editor);
} }
@debug({
@debug<LineHoverController['provideDetailsHover']>({
args: { args: {
0: document => document.uri.toString(true),
1: (position: Position) => `${position.line}:${position.character}`,
2: () => false,
0: document => Logger.toLoggable(document.uri),
1: position => `${position.line}:${position.character}`,
2: false,
}, },
}) })
async provideDetailsHover( async provideDetailsHover(
@ -156,11 +157,11 @@ export class LineHoverController implements Disposable {
return new Hover(message, range); return new Hover(message, range);
} }
@debug({
@debug<LineHoverController['provideChangesHover']>({
args: { args: {
0: document => document.uri.toString(true),
1: (position: Position) => `${position.line}:${position.character}`,
2: () => false,
0: document => Logger.toLoggable(document.uri),
1: position => `${position.line}:${position.character}`,
2: false,
}, },
}) })
async provideChangesHover( async provideChangesHover(

+ 2
- 2
src/statusbar/statusBarController.ts View File

@ -130,9 +130,9 @@ export class StatusBarController implements Disposable {
} }
} }
@debug({
@debug<StatusBarController['onActiveLinesChanged']>({
args: { args: {
0: (e: LinesChangeEvent) =>
0: e =>
`editor=${e.editor?.document.uri.toString(true)}, selections=${e.selections `editor=${e.editor?.document.uri.toString(true)}, selections=${e.selections
?.map(s => `[${s.anchor}-${s.active}]`) ?.map(s => `[${s.anchor}-${s.active}]`)
.join(',')}, pending=${Boolean(e.pending)}, reason=${e.reason}`, .join(',')}, pending=${Boolean(e.pending)}, reason=${e.reason}`,

+ 27
- 8
src/system/decorators/log.ts View File

@ -52,7 +52,16 @@ export function logName(fn: (c: T, name: string) => string) {
export function debug<T extends (...arg: any) => any>( export function debug<T extends (...arg: any) => any>(
options: { options: {
args?: false | Record<string, (arg: any) => string | false>;
args?:
| false
| {
0?: ((arg: Parameters<T>[0]) => unknown) | string | false;
1?: ((arg: Parameters<T>[1]) => unknown) | string | false;
2?: ((arg: Parameters<T>[2]) => unknown) | string | false;
3?: ((arg: Parameters<T>[3]) => unknown) | string | false;
4?: ((arg: Parameters<T>[4]) => unknown) | string | false;
[key: number]: (((arg: any) => unknown) | string | false) | undefined;
};
condition?(...args: Parameters<T>): boolean; condition?(...args: Parameters<T>): boolean;
correlate?: boolean; correlate?: boolean;
enter?(...args: Parameters<T>): string; enter?(...args: Parameters<T>): string;
@ -70,7 +79,16 @@ type PromiseType = T extends Promise ? U : T;
export function log<T extends (...arg: any) => any>( export function log<T extends (...arg: any) => any>(
options: { options: {
args?: false | Record<number, (arg: any) => string | false>;
args?:
| false
| {
0?: ((arg: Parameters<T>[0]) => unknown) | string | false;
1?: ((arg: Parameters<T>[1]) => unknown) | string | false;
2?: ((arg: Parameters<T>[2]) => unknown) | string | false;
3?: ((arg: Parameters<T>[3]) => unknown) | string | false;
4?: ((arg: Parameters<T>[4]) => unknown) | string | false;
[key: number]: (((arg: any) => unknown) | string | false) | undefined;
};
condition?(...args: Parameters<T>): boolean; condition?(...args: Parameters<T>): boolean;
correlate?: boolean; correlate?: boolean;
debug?: boolean; debug?: boolean;
@ -163,16 +181,17 @@ export function log any>(
logFn(`${prefix}${enter}`); logFn(`${prefix}${enter}`);
} }
} else { } else {
const argFns = typeof options.args === 'object' ? options.args : undefined;
let argFn;
const argControllers = typeof options.args === 'object' ? options.args : undefined;
let argController;
let loggable; let loggable;
loggableParams = filterMap(args, (v: any, index: number) => { loggableParams = filterMap(args, (v: any, index: number) => {
const p = parameters[index]; const p = parameters[index];
argFn = argFns !== undefined ? argFns[index] : undefined;
if (argFn !== undefined) {
loggable = argFn(v);
if (loggable === false) return undefined;
argController = argControllers != null ? argControllers[index] : undefined;
if (argController != null) {
if (typeof argController === 'boolean') return undefined;
if (typeof argController === 'string') return argController;
loggable = String(argController(v));
} else { } else {
loggable = Logger.toLoggable(v, options.sanitize); loggable = Logger.toLoggable(v, options.sanitize);
} }

+ 10
- 15
src/trackers/gitLineTracker.ts View File

@ -60,9 +60,9 @@ export class GitLineTracker extends LineTracker {
this._subscriptionOnlyWhenActive = undefined; this._subscriptionOnlyWhenActive = undefined;
} }
@debug({
@debug<GitLineTracker['onBlameStateChanged']>({
args: { args: {
0: (e: DocumentBlameStateChangeEvent<GitDocumentState>) =>
0: e =>
`editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}, blameable=${ `editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}, blameable=${
e.blameable e.blameable
}`, }`,
@ -72,10 +72,9 @@ export class GitLineTracker extends LineTracker {
this.trigger('editor'); this.trigger('editor');
} }
@debug({
@debug<GitLineTracker['onContentChanged']>({
args: { args: {
0: (e: DocumentContentChangeEvent<GitDocumentState>) =>
`editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}`,
0: e => `editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}`,
}, },
}) })
private onContentChanged(e: DocumentContentChangeEvent<GitDocumentState>) { private onContentChanged(e: DocumentContentChangeEvent<GitDocumentState>) {
@ -92,10 +91,9 @@ export class GitLineTracker extends LineTracker {
} }
} }
@debug({
@debug<GitLineTracker['onDirtyIdleTriggered']>({
args: { args: {
0: (e: DocumentDirtyIdleTriggerEvent<GitDocumentState>) =>
`editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}`,
0: e => `editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}`,
}, },
}) })
private onDirtyIdleTriggered(e: DocumentDirtyIdleTriggerEvent<GitDocumentState>) { private onDirtyIdleTriggered(e: DocumentDirtyIdleTriggerEvent<GitDocumentState>) {
@ -105,9 +103,9 @@ export class GitLineTracker extends LineTracker {
this.resume(); this.resume();
} }
@debug({
@debug<GitLineTracker['onDirtyStateChanged']>({
args: { args: {
0: (e: DocumentDirtyStateChangeEvent<GitDocumentState>) =>
0: e =>
`editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}, dirty=${ `editor=${e.editor.document.uri.toString(true)}, doc=${e.document.uri.toString(true)}, dirty=${
e.dirty e.dirty
}`, }`,
@ -121,11 +119,8 @@ export class GitLineTracker extends LineTracker {
} }
} }
@debug({
args: {
0: (selections: LineSelection[]) => selections?.map(s => s.active).join(','),
1: (editor: TextEditor) => editor.document.uri.toString(true),
},
@debug<GitLineTracker['updateState']>({
args: { 0: selections => selections?.map(s => s.active).join(','), 1: e => e.document.uri.toString(true) },
exit: updated => `returned ${updated}`, exit: updated => `returned ${updated}`,
singleLine: true, singleLine: true,
}) })

+ 2
- 2
src/views/nodes/lineHistoryTrackerNode.ts View File

@ -226,9 +226,9 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode
); );
} }
@debug({
@debug<LineHistoryTrackerNode['onActiveLinesChanged']>({
args: { args: {
0: (e: LinesChangeEvent) =>
0: e =>
`editor=${e.editor?.document.uri.toString(true)}, selections=${e.selections `editor=${e.editor?.document.uri.toString(true)}, selections=${e.selections
?.map(s => `[${s.anchor}-${s.active}]`) ?.map(s => `[${s.anchor}-${s.active}]`)
.join(',')}, pending=${Boolean(e.pending)}, reason=${e.reason}`, .join(',')}, pending=${Boolean(e.pending)}, reason=${e.reason}`,

+ 3
- 7
src/views/nodes/repositoryNode.ts View File

@ -358,9 +358,9 @@ export class RepositoryNode extends SubscribeableViewNode {
private _repoUpdatedAt: number = this.repo.updatedAt; private _repoUpdatedAt: number = this.repo.updatedAt;
@debug({
@debug<RepositoryNode['onFileSystemChanged']>({
args: { args: {
0: (e: RepositoryFileSystemChangeEvent) =>
0: e =>
`{ repository: ${e.repository?.name ?? ''}, uris(${e.uris.length}): [${e.uris `{ repository: ${e.repository?.name ?? ''}, uris(${e.uris.length}): [${e.uris
.slice(0, 1) .slice(0, 1)
.map(u => u.fsPath) .map(u => u.fsPath)
@ -397,11 +397,7 @@ export class RepositoryNode extends SubscribeableViewNode {
void this.triggerChange(false); void this.triggerChange(false);
} }
@debug({
args: {
0: (e: RepositoryChangeEvent) => e.toString(),
},
})
@debug<RepositoryNode['onRepositoryChanged']>({ args: { 0: e => e.toString() } })
private onRepositoryChanged(e: RepositoryChangeEvent) { private onRepositoryChanged(e: RepositoryChangeEvent) {
this._repoUpdatedAt = this.repo.updatedAt; this._repoUpdatedAt = this.repo.updatedAt;

+ 1
- 5
src/views/nodes/viewNode.ts View File

@ -491,11 +491,7 @@ export abstract class RepositoryFolderNode<
protected abstract changed(e: RepositoryChangeEvent): boolean; protected abstract changed(e: RepositoryChangeEvent): boolean;
@debug({
args: {
0: (e: RepositoryChangeEvent) => e.toString(),
},
})
@debug<RepositoryFolderNode['onRepositoryChanged']>({ args: { 0: e => e.toString() } })
private onRepositoryChanged(e: RepositoryChangeEvent) { private onRepositoryChanged(e: RepositoryChangeEvent) {
this._repoUpdatedAt = this.repo.updatedAt; this._repoUpdatedAt = this.repo.updatedAt;

+ 1
- 3
src/views/searchAndCompareView.ts View File

@ -95,9 +95,7 @@ export class SearchAndCompareViewNode extends ViewNode {
} }
} }
@log({
args: { 0: (n: ViewNode) => n.toString() },
})
@log<SearchAndCompareViewNode['dismiss']>({ args: { 0: n => n.toString() } })
dismiss(node: ComparePickerNode | CompareResultsNode | SearchResultsNode) { dismiss(node: ComparePickerNode | CompareResultsNode | SearchResultsNode) {
if (node === this.comparePicker) { if (node === this.comparePicker) {
this.removeComparePicker(); this.removeComparePicker();

+ 12
- 24
src/views/viewBase.ts View File

@ -323,16 +323,10 @@ export abstract class ViewBase<
token?: CancellationToken; token?: CancellationToken;
}, },
): Promise<ViewNode | undefined>; ): Promise<ViewNode | undefined>;
@log({
@log<ViewBase<RootNode, ViewConfig>['findNode']>({
args: { args: {
0: (predicate: string | ((node: ViewNode) => boolean)) =>
typeof predicate === 'string' ? predicate : 'function',
1: (opts: {
allowPaging?: boolean;
canTraverse?: (node: ViewNode) => boolean | Promise<boolean>;
maxDepth?: number;
token?: CancellationToken;
}) => `options=${JSON.stringify({ ...opts, canTraverse: undefined, token: undefined })}`,
0: predicate => (typeof predicate === 'string' ? predicate : '<function>'),
1: opts => `options=${JSON.stringify({ ...opts, canTraverse: undefined, token: undefined })}`,
}, },
}) })
async findNode( async findNode(
@ -493,9 +487,7 @@ export abstract class ViewBase<
this.triggerNodeChange(); this.triggerNodeChange();
} }
@debug({
args: { 0: (n: ViewNode) => n.toString() },
})
@debug<ViewBase<RootNode, ViewConfig>['refreshNode']>({ args: { 0: n => n.toString() } })
async refreshNode(node: ViewNode, reset: boolean = false, force: boolean = false) { async refreshNode(node: ViewNode, reset: boolean = false, force: boolean = false) {
const cancel = await node.refresh?.(reset); const cancel = await node.refresh?.(reset);
if (!force && cancel === true) return; if (!force && cancel === true) return;
@ -503,9 +495,7 @@ export abstract class ViewBase<
this.triggerNodeChange(node); this.triggerNodeChange(node);
} }
@log({
args: { 0: (n: ViewNode) => n.toString() },
})
@log<ViewBase<RootNode, ViewConfig>['reveal']>({ args: { 0: n => n.toString() } })
async reveal( async reveal(
node: ViewNode, node: ViewNode,
options?: { options?: {
@ -537,11 +527,8 @@ export abstract class ViewBase<
return this._lastKnownLimits.get(node.id); return this._lastKnownLimits.get(node.id);
} }
@debug({
args: {
0: (n: ViewNode & PageableViewNode) => n.toString(),
3: (n?: ViewNode) => (n == null ? '' : n.toString()),
},
@debug<ViewBase<RootNode, ViewConfig>['loadMoreNodeChildren']>({
args: { 0: n => n.toString(), 2: n => n?.toString() },
}) })
async loadMoreNodeChildren( async loadMoreNodeChildren(
node: ViewNode & PageableViewNode, node: ViewNode & PageableViewNode,
@ -556,14 +543,15 @@ export abstract class ViewBase<
this._lastKnownLimits.set(node.id, node.limit); this._lastKnownLimits.set(node.id, node.limit);
} }
@debug({ args: { 0: (n: ViewNode) => n.toString() }, singleLine: true })
@debug<ViewBase<RootNode, ViewConfig>['resetNodeLastKnownLimit']>({
args: { 0: n => n.toString() },
singleLine: true,
})
resetNodeLastKnownLimit(node: PageableViewNode) { resetNodeLastKnownLimit(node: PageableViewNode) {
this._lastKnownLimits.delete(node.id); this._lastKnownLimits.delete(node.id);
} }
@debug({
args: { 0: (n: ViewNode) => (n != null ? n.toString() : '') },
})
@debug<ViewBase<RootNode, ViewConfig>['triggerNodeChange']>({ args: { 0: n => n?.toString() } })
triggerNodeChange(node?: ViewNode) { triggerNodeChange(node?: ViewNode) {
// Since the root node won't actually refresh, force everything // Since the root node won't actually refresh, force everything
this._onDidChangeTreeData.fire(node != null && node !== this.root ? node : undefined); this._onDidChangeTreeData.fire(node != null && node !== this.root ? node : undefined);

+ 2
- 10
src/vsls/vsls.ts View File

@ -124,11 +124,7 @@ export class VslsController implements Disposable {
return contacts.contacts[email]; return contacts.contacts[email];
} }
@debug({
args: {
0: (emails: string[]) => `length=${emails.length}`,
},
})
@debug<VslsController['getContacts']>({ args: { 0: emails => emails.length } })
private async getContacts(emails: string[]) { private async getContacts(emails: string[]) {
const api = await this._api; const api = await this._api;
if (api == null) return undefined; if (api == null) return undefined;
@ -145,11 +141,7 @@ export class VslsController implements Disposable {
return contactStatusToPresence(contact.status); return contactStatusToPresence(contact.status);
} }
@debug({
args: {
0: (emails: string[]) => `length=${emails.length}`,
},
})
@debug<VslsController['getContactsPresence']>({ args: { 0: emails => emails.length } })
async getContactsPresence(emails: string[]): Promise<Map<string, ContactPresence> | undefined> { async getContactsPresence(emails: string[]): Promise<Map<string, ContactPresence> | undefined> {
const contacts = await this.getContacts(emails); const contacts = await this.getContacts(emails);
if (contacts == null) return undefined; if (contacts == null) return undefined;

+ 1
- 1
src/webviews/rebaseEditor.ts View File

@ -162,7 +162,7 @@ export class RebaseEditorProvider implements CustomTextEditorProvider, Disposabl
await configuration.updateAny('workbench.editorAssociations', associations, ConfigurationTarget.Global); await configuration.updateAny('workbench.editorAssociations', associations, ConfigurationTarget.Global);
} }
@debug<RebaseEditorProvider['resolveCustomTextEditor']>({ args: false })
@debug({ args: false })
async resolveCustomTextEditor(document: TextDocument, panel: WebviewPanel, _token: CancellationToken) { async resolveCustomTextEditor(document: TextDocument, panel: WebviewPanel, _token: CancellationToken) {
const repoPath = Strings.normalizePath(Uri.joinPath(document.uri, '..', '..', '..').fsPath); const repoPath = Strings.normalizePath(Uri.joinPath(document.uri, '..', '..', '..').fsPath);
const repo = await this.container.git.getRepository(repoPath); const repo = await this.container.git.getRepository(repoPath);

Loading…
Cancel
Save