mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 01:25:43 -05:00
Adds debugging info to CodeLens
This commit is contained in:
@@ -232,7 +232,7 @@ export default class GitCodeLensProvider implements CodeLensProvider {
|
||||
const recentCommit = Iterables.first(blame.commits.values());
|
||||
title = `${recentCommit.author}, ${moment(recentCommit.date).fromNow()}`;
|
||||
if (this._config.advanced.debug && this._config.advanced.output.level === OutputLevel.Verbose) {
|
||||
title += ` [${recentCommit.sha}, Symbol(${SymbolKind[lens.symbolKind]}), Lines(${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1})]`;
|
||||
title += ` [Commit (${recentCommit.sha}), Symbol (${SymbolKind[lens.symbolKind]}), Lines (${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1})]`;
|
||||
}
|
||||
|
||||
switch (this._config.codeLens.recentChange.command) {
|
||||
@@ -251,6 +251,9 @@ export default class GitCodeLensProvider implements CodeLensProvider {
|
||||
const blame = lens.getBlame();
|
||||
const count = blame.authors.size;
|
||||
let title = `${count} ${count > 1 ? 'authors' : 'author'} (${Iterables.first(blame.authors.values()).name}${count > 1 ? ' and others' : ''})`;
|
||||
if (this._config.advanced.debug && this._config.advanced.output.level === OutputLevel.Verbose) {
|
||||
title += ` [Authors (${Iterables.join(Iterables.map(blame.authors.values(), _ => _.name), ', ')}), Symbol (${SymbolKind[lens.symbolKind]}), Lines (${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1})]`;
|
||||
}
|
||||
|
||||
switch (this._config.codeLens.authors.command) {
|
||||
case CodeLensCommand.BlameAnnotate: return this._applyBlameAnnotateCommand<GitAuthorsCodeLens>(title, lens, blame);
|
||||
|
||||
@@ -54,6 +54,28 @@ export namespace Iterables {
|
||||
return typeof source[Symbol.iterator] === 'function';
|
||||
}
|
||||
|
||||
export function join(source: Iterable<any>, separator: string): string {
|
||||
let value: string = '';
|
||||
|
||||
const iterator = source[Symbol.iterator]();
|
||||
let next = iterator.next();
|
||||
if (next.done) return value;
|
||||
|
||||
while (true) {
|
||||
const s = next.value.toString();
|
||||
|
||||
next = iterator.next();
|
||||
if (next.done) {
|
||||
value += s;
|
||||
break;
|
||||
}
|
||||
|
||||
value += `${s}${separator}`;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
export function last<T>(source: Iterable<T>): T {
|
||||
let item: T;
|
||||
for (item of source) { /* noop */ }
|
||||
|
||||
Reference in New Issue
Block a user