Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exploration #8867

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/vs/workbench/parts/files/browser/media/explorerviewlet.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,19 @@
.hc-black .monaco-workbench .explorer-viewlet .open-editor,
.hc-black .monaco-workbench .explorer-viewlet .editor-group {
line-height: 20px;
}
}

/* Icons */

.explorer-viewlet .explorer-item {
background-size: 16px !important;
padding-left: 22px;
}

.explorer-viewlet .explorer-item.text-file-icon { background: url(icons/file.svg) 1px 3px no-repeat; }
.explorer-viewlet .explorer-item.folder-icon { background: url(icons/folder.svg) 1px 3px no-repeat; }
.explorer-viewlet .expanded .explorer-item.folder-icon { background: url(icons/folder_expanded.svg) 1px 3px no-repeat; }

.explorer-viewlet .explorer-item.text-file-ext-ts { background: url(icons/[email protected]) 1px 3px no-repeat; }
.explorer-viewlet .explorer-item.text-file-ext-d-ts { background: url(icons/[email protected]) 1px 3px no-repeat; }
.explorer-viewlet .explorer-item.text-file-ext-js { background: url(icons/[email protected]) 1px 3px no-repeat; }
9 changes: 9 additions & 0 deletions src/vs/workbench/parts/files/browser/media/icons/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions src/vs/workbench/parts/files/browser/media/icons/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 17 additions & 4 deletions src/vs/workbench/parts/files/browser/views/explorerViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';

import path = require('path');
import {TPromise} from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import lifecycle = require('vs/base/common/lifecycle');
Expand Down Expand Up @@ -279,7 +280,8 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {

public renderContents(tree: ITree, stat: FileStat, domElement: HTMLElement, previousCleanupFn: IElementCallback): IElementCallback {
let el = $(domElement).clearChildren();
let item = $('.explorer-item').addClass(this.iconClass(stat)).appendTo(el);
let item = $('.explorer-item');
item.addClass.apply(item, this.iconClasses(stat)).appendTo(el);

// File/Folder label
let editableData: IEditableData = this.state.getEditableData(stat);
Expand Down Expand Up @@ -337,12 +339,23 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
return () => done(true);
}

private iconClass(element: FileStat): string {
private iconClasses(element: FileStat): string[] {
if (element.isDirectory) {
return 'folder-icon';
return ['folder-icon'];
}

return 'text-file-icon';
let filePath = element.resource.fsPath;
let extension = path.extname(filePath);
if (filePath.match(/\.d\.ts$/)) {
extension = 'd-ts';
}
if (extension.length === 0) {
// Treat dot files (eg. .gitignore) as extensions
extension = path.basename(filePath);
}
extension = extension.replace('.', '');

return ['text-file-icon', `text-file-ext-${extension}`];
}
}

Expand Down