Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected collectDecorators(tree: Tree): Map {
const result = new Map();
// If the tree root is undefined or the preference for the decorations is disabled, return an empty result map.
if (tree.root === undefined || !this.problemPreferences['problems.decorations.enabled']) {
return result;
}
const markers = this.appendContainerMarkers(tree, this.collectMarkers(tree));
for (const node of new DepthFirstTreeIterator(tree.root)) {
const nodeUri = FileStatNode.getUri(node);
if (nodeUri) {
const marker = markers.get(nodeUri);
if (marker) {
result.set(node.id, marker);
}
}
}
return new Map(Array.from(result.entries()).map(m => [m[0], this.toDecorator(m[1])] as [string, TreeDecoration.Data]));
}
protected collectDecorators(tree: Tree): Map {
const result = new Map();
if (tree.root === undefined || !this.decorationsMap) {
return result;
}
const markers = this.appendContainerChanges(this.decorationsMap);
for (const treeNode of new DepthFirstTreeIterator(tree.root)) {
const uri = FileStatNode.getUri(treeNode);
if (uri) {
const marker = markers.get(uri);
if (marker) {
result.set(treeNode.id, marker);
}
}
}
return new Map(Array.from(result.entries()).map(m => [m[0], this.toDecorator(m[1])] as [string, TreeDecoration.Data]));
}
protected collectDecorators(tree: Tree, status: WorkingDirectoryStatus | undefined): Map {
const result = new Map();
if (tree.root === undefined || !this.enabled) {
return result;
}
const markers = this.appendContainerChanges(tree, status ? status.changes : []);
for (const treeNode of new DepthFirstTreeIterator(tree.root)) {
const uri = FileStatNode.getUri(treeNode);
if (uri) {
const marker = markers.get(uri);
if (marker) {
result.set(treeNode.id, marker);
}
}
}
return new Map(Array.from(result.entries()).map(m => [m[0], this.toDecorator(m[1])] as [string, TreeDecoration.Data]));
}