Adds debugging info to CodeLens

This commit is contained in:
Eric Amodio
2017-03-05 15:42:11 -05:00
parent f1ec0ec0b2
commit c05fd0b976
2 changed files with 26 additions and 1 deletions

View File

@@ -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);

View File

@@ -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 */ }