Skip to content

Add file icons support in the explorer #211

Closed

Description

@marzubov

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.

Activity

  1. samueleaton commented on Nov 21, 2015

    @samueleaton

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

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

  2. added
    feature-request
    on Nov 24, 2015
  3. roddolf commented on Jan 26, 2016

    @roddolf

    +1

  4. philipgiuliani commented on Jan 27, 2016

    @philipgiuliani

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

    bildschirmfoto 2016-01-27 um 09 09 45

  5. zippoxer commented on Jan 30, 2016

    @zippoxer

    Any progress on this?

  6. pflannery commented on Jan 31, 2016

    @pflannery

    +1

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

  7. TheColorRed commented on Feb 6, 2016

    @TheColorRed

    +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.

  8. san8pai commented on Feb 18, 2016

    @san8pai

    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.)

  9. philipgiuliani commented on Feb 18, 2016

    @philipgiuliani

    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.

  10. nelsonlaquet commented on Feb 26, 2016

    @nelsonlaquet

    This feature is sorely needed, and is trivial to implement. I was able to use Peter Flannery (@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.

  11. pflannery commented on Mar 10, 2016

    @pflannery

    Nelson LaQuet (@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)

  12. nepaul commented on Mar 24, 2016

    @nepaul

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

  13. 64 remaining items

  14. leaxoy commented on Jul 10, 2016

    @leaxoy

    +1

  15. darkguy2008 commented on Jul 21, 2016

    @darkguy2008

    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...

  16. darkguy2008 commented on Jul 21, 2016

    @darkguy2008

    George S (@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 👍

  17. MarkPieszak commented on Jul 26, 2016

    @MarkPieszak

    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!

  18. added
    plan-item
    on Aug 16, 2016
  19. namoen0301 commented on Aug 24, 2016

    @namoen0301

    +1
    Very useful feature.

  20. aeschli commented on Sep 2, 2016

    @aeschli
    Contributor

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

  21. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apifeature-requestfile-explorerplan-item

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions