Browse Source

Adds dbg info to view node tooltips when debugging

main
Eric Amodio 5 years ago
parent
commit
38bf21ccb2
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      src/views/nodes/viewNode.ts

+ 18
- 0
src/views/nodes/viewNode.ts View File

@ -69,6 +69,16 @@ export abstract class ViewNode {
constructor(uri: GitUri, public readonly view: TView, protected readonly parent?: ViewNode) { constructor(uri: GitUri, public readonly view: TView, protected readonly parent?: ViewNode) {
this._instanceId = getViewNodeInstanceId(); this._instanceId = getViewNodeInstanceId();
this._uri = uri; this._uri = uri;
if (Logger.isDebugging) {
const fn = this.getTreeItem;
this.getTreeItem = async function(this: ViewNode<TView>) {
const item = await fn.apply(this);
item.tooltip = `${item.tooltip || item.label}\n\nDBG: ${this.toString()}`;
return item;
};
}
} }
toString() { toString() {
@ -111,10 +121,18 @@ export abstract class ViewRefNode extends ViewNode
get repoPath(): string { get repoPath(): string {
return this.uri.repoPath!; return this.uri.repoPath!;
} }
toString() {
return `${super.toString()}: ${this.ref}`;
}
} }
export abstract class ViewRefFileNode<TView extends View = View> extends ViewRefNode<TView> { export abstract class ViewRefFileNode<TView extends View = View> extends ViewRefNode<TView> {
abstract get fileName(): string; abstract get fileName(): string;
toString() {
return `${super.toString()}:${this.fileName}`;
}
} }
export interface PageableViewNode { export interface PageableViewNode {

Loading…
Cancel
Save