Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
canHandle(uri: object): number {
let toCheck = uri;
if (FileStat.is(toCheck)) {
toCheck = new URI(toCheck.uri);
}
if (toCheck instanceof URI) {
if (toCheck.path.ext === '.coffee') {
return 1000;
}
}
return 0;
}
if (element.expanded) {
return [this.rootFolderExpandedIcon, this.expandedFolderNameIcon(name)];
}
return [this.rootFolderIcon, this.folderNameIcon(name)];
}
if (DirNode.is(element)) {
if (element.expanded) {
const name = this.labelProvider.getName(element);
return [this.folderExpandedIcon, this.expandedFolderNameIcon(name)];
}
return this.getFolderClassNames(element);
}
if (FileStatNode.is(element)) {
return this.getFileClassNames(element, element.fileStat.uri);
}
if (FileStat.is(element)) {
if (element.isDirectory) {
return this.getFolderClassNames(element);
}
return this.getFileClassNames(element, element.uri);
}
if (URIIconReference.is(element)) {
if (element.id === 'folder') {
return this.getFolderClassNames(element);
}
return this.getFileClassNames(element, element.uri && element.uri.toString());
}
return this.getFileClassNames(element, element.toString());
}
protected getUri(element: URI | URIIconReference | FileStat): URI | undefined {
if (FileStat.is(element)) {
return new URI(element.uri);
}
return super.getUri(element);
}
}
protected asURIIconReference(element: URI | URIIconReference | FileStat): URI | URIIconReference {
if (FileStat.is(element)) {
return URIIconReference.create(element.isDirectory ? 'folder' : 'file', new URI(element.uri));
}
return element;
}
canHandle(element: object): number {
if ((element instanceof URI && element.scheme === 'file' || URIIconReference.is(element) || FileStat.is(element))) {
return 10;
}
return 0;
}