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

Add file icons support in the explorer #211

Closed
marzubov opened this issue Nov 19, 2015 · 75 comments
Closed

Add file icons support in the explorer #211

marzubov opened this issue Nov 19, 2015 · 75 comments
Assignees
Labels
api feature-request Request for new features or functionality file-explorer Explorer widget issues plan-item VS Code - planned item for upcoming
Milestone

Comments

@marzubov
Copy link

Can you please add file icons support in the tree view?

I know that access from extension to the DOM is restricted. But it will be good to add some language-id attribute to the tree-view element. For example in the render function. So it will be easy to modify view of files with different types with CSS, without modifying DOM.

And also It will be nice to add possibility to add/modify directly CSS from extension.

@samueleaton
Copy link

I agree. Here is a screenshot of what I have in sublime.

screen shot 2015-11-21 at 1 41 13 pm

@jrieken jrieken added the feature-request Request for new features or functionality label Nov 24, 2015
@egamma egamma modified the milestone: Backlog Dec 10, 2015
@bpasero bpasero added the file-explorer Explorer widget issues label Dec 18, 2015
@roddolf
Copy link

roddolf commented Jan 26, 2016

+1

@philipgiuliani
Copy link

+1 I can find files much faster with the icons!

bildschirmfoto 2016-01-27 um 09 09 45

@zippoxer
Copy link

Any progress on this?

@pflannery
Copy link

+1

Maybe its possible to add a language and\or file-ext attributes here for themes to render icons?

@TheColorRed
Copy link

+1

I mostly have issues trying to distinguish the difference between a file and a folder quickly. There isn't even a text color difference.

@san8pai
Copy link

san8pai commented Feb 18, 2016

What is interesting is that there is logic in place to add icon classes:
https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/files/browser/views/explorerViewer.ts

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

        return 'text-file-icon';
}

As seen above, vscode currently adds a folder-icon css class to all folders but a style is not defined for it. So if you want to see folder icon in explorer, all you have to do is add the below styles to /resources/app/out/vs/workbench/workbench.main.css

.monaco-tree-row .content .sub-content .explorer-item.folder-icon {
    padding-left: 22px;
    background: url(./parts/files/browser/media/Folder.png) 1px 4px no-repeat;
}
.monaco-tree-row.expanded .content .sub-content .explorer-item.folder-icon {
    padding-left: 22px;
    background: url(./parts/files/browser/media/Folder_opened.png) 1px 4px no-repeat;
}
.explorer-item.text-file-icon { 
    padding-left: 22px;
    background: url(./parts/files/browser/media/Textfile.png) 1px 4px no-repeat;
 }

and copy the below icon images to /resources/app/out/vs/workbench/parts/files/browser/media
folder closed Folder.png
folder opened Folder_opened.png
textfile Textfile.png

Here is a preview of it in action:
Preview

In it's simplest form, implementing the file icon feature would require modifying the above iconClass method to return 'text-file-' + getFileExtension(element.name) and adding corresponding icon svg/font to each css classes (i.e., text-file-js, text-file-md, etc.)

@philipgiuliani
Copy link

Nice find @Snpai. It would be very easy if they could add another class like text-file text-file-md. So extensions could use it to just add another CSS with all the icons.

@nelsonlaquet
Copy link

This feature is sorely needed, and is trivial to implement. I was able to use @pflannery's fork and https://github.com/mrmartineau/SetiUI-Icons-Sublime to add in default icons right into the my own build.

One thing though: some files should be themed based off of more than extension. package.json, gulpfile.js, etc should be themed based off of name. I suppose adding built-in support for specific filename classes would be better (faster/less cluttering to the DOM) than adding a class for the entirety of every file's name.

While we wait, does anyone have a comprehensive, "good" looking grayscale icon pack? The icon pack I used doesn't mesh very well with the dark theme and is a little distracting.

@pflannery
Copy link

@nelsonlaquet you made a good point about the gulp, grunt and package.json files and thanks for linking the icons too.
I've updated my PR which puts the filename in to attributes allowing special icons for specific files.
I've also added support for css theming because I feel that this is the cleanest and simplest way to deliver this feature.
Check out my comments here for more info #3200 (comment)

@nepaul
Copy link

nepaul commented Mar 24, 2016

+1
I can find files much faster with the icons!

@fa7ad
Copy link

fa7ad commented Apr 1, 2016

Is the file tree exposed to extensions api? if you can expose it, i think that would allow the community to create an extension for this and for any further opinionated customizations all the while VSCode itself can remain neutral on the issue

@Tyriar Tyriar added the api label Apr 1, 2016
@ivogabe
Copy link

ivogabe commented Apr 1, 2016

If that would be added, I'd like to port my icon extension (Brackets Icons) for Brackets to VS Code. In Brackets, an icon provider can be added, which is a function that returns an icon as a DOM element for a specified file name (docs). Since VS Code doesn't expose the DOM, there should be a layer between, but similar ideas can be used.

@bpasero
Copy link
Member

bpasero commented Apr 1, 2016

No API atm to change the explorer.

@fa7ad
Copy link

fa7ad commented Apr 1, 2016

@bpasero is there plans for such a thing in the near future? if yes, any rough ETA?

@bpasero
Copy link
Member

bpasero commented Apr 1, 2016

@egamma @chrisdias please chime in.

@ghost
Copy link

ghost commented Apr 5, 2016

+1

@donaldpipowitch
Copy link
Contributor

@bpasero Could you list the needed acceptance criteria to get a pull request merged? Maybe I could help then.

@bpasero bpasero changed the title Add file icons support. Add file icons support in the explorer Apr 5, 2016
@bpasero
Copy link
Member

bpasero commented Apr 5, 2016

@donaldpipowitch I would think this feature should:

  • be configurable with a flag in settings
  • provide the necessary icons for all themes (SVG)

Still, our PM/UX might decide to veto. @chrisdias @stevencl please chime in.

@fa7ad
Copy link

fa7ad commented Jun 2, 2016

@Tyriar do you guys (core team) have a proper API planned then? I understand this is a hack, but this is as close as we can get without support from the core team.

@gsaadeh
Copy link

gsaadeh commented Jun 2, 2016

Thanks for the explanation @Tyriar. I agree that it's a hack but at least it will keep a few of us happy until the official support. If there is an existing plan of how you guys want to implement it, I will be very glad to contribute.

@Tyriar
Copy link
Member

Tyriar commented Jun 2, 2016

A few of us have been talking about it, we need to have a team-wide discussion ideally in a GitHub issue.

@marzubov
Copy link
Author

marzubov commented Jun 2, 2016

Thanks, @robertohuertasm for making an extension that gives file icons to the vscode is really nice, even if it's hacky.
Since the team is spread and focused on other tasks, I think it will be good to analyze and propose some changings to existing extension API, that will allow fully support extensions like vscode-icons without any hacks and won't break existing one. Then we can apply changes to the fork and make a custom build, so users could easily install it and perhaps even update.
Any thoughts?

@Sequoia
Copy link

Sequoia commented Jun 14, 2016

I know I should know better than to armchair project-manage, but this feels like low hanging fruit with a big ROI. I like VSCode for it's deep support of various JS features + intellisense --icons aren't a make or break feature for me-- but there a lot of people for whom this is a make-or-break feature. I guarantee there are visually oriented folks who will try VSCode then quickly bounce back to Sublime/Brackets/whatever when they see that this basic feature is missing.

My intuition-based belief: not having this feature will have a significant negative impact on the adoption of VS Code. It's silly but I believe it's true. I care because I really like VS Code & I am recommending it to people, I want them to like it. 😸

@miguelchico
Copy link

+1

kisstkondoros added a commit to kisstkondoros/vscode that referenced this issue Jul 3, 2016
A first example is also included: gitStatusTreeDecorator

Resolves microsoft#5866
Related microsoft#211
@Tyriar Tyriar self-assigned this Jul 7, 2016
@Tyriar Tyriar mentioned this issue Jul 8, 2016
@leaxoy
Copy link

leaxoy commented Jul 10, 2016

+1

@darkguy2008
Copy link

Any progress on this? I want to replace sublime with vscode but it's hard to find file types without icons. I can't believe something so essential is missing...

@gsaadeh
Copy link

gsaadeh commented Jul 21, 2016

@darkguy2008 For now you can use https://marketplace.visualstudio.com/items?itemName=robertohuertasm.vscode-icons until the official support. It works well!

@darkguy2008
Copy link

@gsaadeh yeah I just found it, thanks! it takes some trial and error to get it installed and working at first though. It'd be a good idea to merge the extension in VSCode's core though 👍

@MarkPieszak
Copy link

MarkPieszak commented Jul 26, 2016

If anyone has issues on Windows7 with the icons not appearing:

Just figured it out. For some reason even when pushing "Enable" it doesn't fire the event. I had to do:

ctrl-shift-P
then type:
Icons Enable

Then they appeared. Just a note for anyone else who runs into it!

@bpasero bpasero modified the milestones: August 2016, Backlog Aug 14, 2016
@bpasero bpasero assigned aeschli and unassigned Tyriar Aug 14, 2016
@bpasero bpasero added the plan-item VS Code - planned item for upcoming label Aug 16, 2016
@bpasero bpasero removed their assignment Aug 22, 2016
@wbsdty331
Copy link

+1
Very useful feature.

@aeschli
Copy link
Contributor

aeschli commented Sep 2, 2016

Added support for file icon themes. See #10804 for documentation.

@aeschli aeschli closed this as completed Sep 2, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality file-explorer Explorer widget issues plan-item VS Code - planned item for upcoming
Projects
None yet
Development

No branches or pull requests