Skip to content

Commit

Permalink
fix leaf nodes having expanders and titles for sub-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pvh committed Nov 22, 2018
1 parent ef55727 commit 62446d3
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/treeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,22 @@ export class HypermergeTreeDataProvider
return this.hypermergeWrapper
.openDocumentUri(resourceUri)
.then((content: any) => {
let { docId, keyPath, label } = details;
if (!label) {
if (keyPath.length) {
label = keyPath.pop();
} else if (content.title) {
label = `[${docId.slice(0, 5)}] ${content.title}`;
} else {
label = docId;
}
let { docId, keyPath } = details;

let label;
if (keyPath.length) {
label = keyPath.pop();
} else if (content.title) {
label = `[${docId.slice(0, 5)}] ${content.title}`;
} else {
label = docId;
}

// ideally we should determine if the node has / can have children
const collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
const collapsibleState =
content instanceof Array || content instanceof Object
? vscode.TreeItemCollapsibleState.Collapsed
: vscode.TreeItemCollapsibleState.None;
return {
label,
resourceUri,
Expand Down Expand Up @@ -140,7 +143,7 @@ export class HypermergeTreeDataProvider
content[child]
);
if (docId) {
return "hypermerge://" + docId + "/?label=" + child + "-" + docId;
return "hypermerge://" + docId + "/";
}
}
// this builds a new child URL and ditches the label if it exists.
Expand Down

0 comments on commit 62446d3

Please sign in to comment.