Coder Social home page Coder Social logo

atom-fs's Introduction

File Icons

Build status: TravisCI Latest package version

File-specific icons in Atom for improved visual grepping.

Icon previews

Supports the following core packages:

An API is offered for packages not listed above. See the integration steps for more info.

Installation

Open SettingsInstall and search for file-icons.

Alternatively, install through command-line:

apm install --production file-icons

Customisation

Everything is handled using CSS classes. Use your stylesheet to change or tweak icons.

Consult the package stylesheets to see what classes are used:

Icon reference

Examples

Resize an icon

.html5-icon:before{
	font-size: 18px;
}

// Resize in tab-pane only:
.tab > .html5-icon:before{
	font-size: 18px;
	top: 3px;
}

Choose your own shades of orange

.dark-orange   { color: #6a1e05; }
.medium-orange { color: #b8743d; }
.light-orange  { color: #cf9b67; }

Bring back PHP's blue-shield icon

.php-icon:before{
	font-family: MFizz;
	content: "\f147";
}

Assign icons by file extension

The following examples use attribute selectors to target specific pathnames:

.icon[data-name$=".js"]:before{
	font-family: Devicons;
	content: "\E64E";
}

Assign icons to directories

.directory > .header > .icon{
	&[data-path$=".atom/packages"]:before{
		font-family: "Octicons Regular";
		content: "\f0c4";
	}
}

Troubleshooting

I see this error after installing:

"Cannot read property 'onDidChangeIcon' of undefined"

A restart is needed to complete installation. Reload the window, or restart Atom.

If this doesn't help, please file an issue.

Installation halts with an npm error:

npm ERR! cb() never called!

There might be a corrupted download in your local cache. Delete ~/.atom/.apm, then try again:

rm -rf ~/.atom/.apm
apm install --production file-icons

An icon has stopped updating:

It's probably a caching issue. Do the following:

  1. Open the command palette: Cmd/Ctrl + Shift + P
  2. Run file-icons:clear-cache
  3. Reload the window, or restart Atom

Ruby files are showing the wrong font:

If language-ethereum is installed, remove it. This is a known issue with the package, which is no longer maintained. For Solidity support, use linter-solidity or language-solidity instead.

If language-ethereum isn't installed, please follow these steps and file an issue.

The tree-view's files are borked and look like this:

If you haven't restarted Atom since upgrading to File-Icons v2, do so now.

If restarting doesn't help, your stylesheet probably needs updating. See below.

My stylesheet has errors since updating:

As of v2.0, classes are used for displaying icons instead of mixins. Delete lines like these from your stylesheet:

-@import "packages/file-icons/styles/icons";
-@import "packages/file-icons/styles/items";
-@{pane-tab-selector},
.icon-file-directory {
	&[data-name=".git"]:before {
-		.git-icon;
+		font-family: Devicons;
+		content: "\E602";
	}
}

Instead of @pane-tab… variables, use .tab > .icon[data-path]:

-@pane-tab-selector,
-@pane-tab-temp-selector,
-@pane-tab-override {
+.tab > .icon {
 	&[data-path$=".to.file"] {
 		
 	}
}

These CSS classes are no longer used, so delete them:

-.file-icons-force-show-icons,
-.file-icons-tab-pane-icon,
-.file-icons-on-changes

It's something else.

Please file an issue. Include screenshots if necessary.

Integration with other packages

If you're a package author, you can integrate File-Icons using Atom's services API.

First, add this to your package.json file:

"consumedServices": {
	"file-icons.element-icons": {
		"versions": {
			"1.0.0": "consumeElementIcons"
		}
	}
}

Secondly, add a function named consumeElementIcons (or whatever you named it) to your package's main export:

let addIconToElement;
module.exports.consumeElementIcons = function(func){
	addIconToElement = func;
};

Then call the function it gets passed to display icons in the DOM:

let fileIcon = document.querySelector("li.file-entry > span.icon");
addIconToElement(fileIcon, "/path/to/file.txt");

The returned value is a Disposable which clears the icon from memory once it's no longer needed:

const disposable = addIconToElement(fileIcon, "/path/to/file.txt");
fileIcon.onDestroy(() => disposable.dispose());

NOTE: Remember to remove any default icon-classes before calling the service handler!

 let fileIcon = document.querySelector("li.file-entry > span.icon");
+fileIcon.classList.remove("icon-file-text");
 const disposable = addIconToElement(fileIcon, "/path/to/file.txt");

Sponsors

Huge thanks to the following backers who generously sponsored this project in the past:

Justin Ireland Tipe Triplebyte TakeShape Targeted Web Traffic

Acknowledgements

v1 was originally based on sommerper/filetype-color. v2 was completely rewritten. Both versions owe their success to innumerable contributions from the Atom community.

atom-fs's People

Contributors

alhadis avatar hansonw avatar utkarshgupta137 avatar

Watchers

 avatar  avatar

atom-fs's Issues

Random wrong icons when using SFTP

I have mounted a virtual private server via sftp (Mountain Duck & STFTP Net Drive 2017) to my windows explorer as network drives. When I open a project folder on the server the icons are almost comepletly broken and wrong. When I open the same folder structure locally the icons are perfectly fine. Also to mention is that folders seem to be affected as well.

This is how it should be displayed (local folder structure):
local

This is how it is displayed when opening the folder on the vps:
sftp

Not sure if helpful but I'll provide some further system information below.
Local System: Windows 10 1709 (Build 16299.125)
Atom Version: 1.23.3
file-icons Version: 2.1.16
VPS: Debian GNU/Linux 8 (jessie) | Kernel: Linux 3.16.0-5-amd64 | x86-64

Edit: The issue appears randomly but pretty often. However I can't find a way to reproduce it consistently.

Prevents updating of symlink status in tree-view

Found using Atom 1.17 and file-icons 2.1.6 on an Ubuntu 17.04 machine:

  1. While Atom is open and the tree-view shows your project folder
  2. cp a random file into the project folder
  3. rm that copy immediately
  4. ln -s the same file into the project folder

The icon now shows up like it did in step 2 instead of showing a symlink. Restarting Atom fixes the problem. The same effect happens when swicthing cpand ln -s only now staying as a symlink instead of showing the icon.

Git repository icon not shown as repository

Hi @Alhadis,

As discussed, here the new issue. For some reason some of the repositories are not recognized as such.

My packages are:

Some extra info:

apm  1.17.0
npm  3.10.5
node 6.9.5 x64
python 2.7.13
git 2.10.1.windows.1

Here the screenshot:
image
The last 5 projects should have the git repository icon as the one's on the top.

Many thanks! :)

Atom Electron 9 development version: Cannot mix BigInt and other types

Trying the Atom Electron 9 development version ( atom/atom#21777 ) it gives the following error.
Probably easy to fix, and would make this package ready for the upcoming Atom development update.

Atom: 1.56.0-dev-a241462b x64
Electron: 9.4.1
OS: Ubuntu 20.10
Thrown From: file-icons package 2.1.46

Stack Trace

Failed to activate the file-icons package

At Cannot mix BigInt and other types, use explicit conversions

TypeError: Cannot mix BigInt and other types, use explicit conversions
    at BigIntStats._checkModeProperty (internal/fs/utils.js:364:21)
    at BigIntStats.StatsBase.isDirectory (internal/fs/utils.js:287:15)
    at FileSystem.resolveType (/packages/file-icons/node_modules/atom-fs/lib/filesystem.js:110:28)
    at FileSystem.get (/packages/file-icons/node_modules/atom-fs/lib/filesystem.js:69:13)
    at /packages/file-icons/lib/ui.js:34:29
    at Function.simpleDispatch (/usr/share/atom-dev/resources/app/static/<embedded>:11:1187699)
    at Emitter.emit (/usr/share/atom-dev/resources/app/static/<embedded>:11:1189140)
    at /packages/file-icons/lib/ui.js:61:19
    at Workspace.observeTextEditors (/usr/share/atom-dev/resources/app/static/<embedded>:11:428692)
    at UI.observe (/packages/file-icons/lib/ui.js:56:19)
    at Object.activate (/packages/file-icons/lib/main.js:14:11)
    at Package.activateNow (/usr/share/atom-dev/resources/app/static/<embedded>:11:3447088)
    at /usr/share/atom-dev/resources/app/static/<embedded>:11:3446500
    at Package.measure (/usr/share/atom-dev/resources/app/static/<embedded>:11:3444078)
    at /usr/share/atom-dev/resources/app/static/<embedded>:11:3446360
    at new Promise (<anonymous>)
    at Package.activate (/usr/share/atom-dev/resources/app/static/<embedded>:11:3446303)
    at PackageManager.activatePackage (/usr/share/atom-dev/resources/app/static/<embedded>:11:382851)
    at /usr/share/atom-dev/resources/app/static/<embedded>:11:382467
    at Config.transactAsync (/usr/share/atom-dev/resources/app/static/<embedded>:11:331995)
    at PackageManager.activatePackages (/usr/share/atom-dev/resources/app/static/<embedded>:11:382417)
    at PackageManager.activate (/usr/share/atom-dev/resources/app/static/<embedded>:11:381967)
    at /usr/share/atom-dev/resources/app/static/<embedded>:1:719227
    at async Promise.all (index 0)
    at AtomEnvironment.startEditorWindow (/usr/share/atom-dev/resources/app/static/<embedded>:1:719712)

Non-Core Packages

busy-signal 2.0.1 
file-icons 2.1.46 
intentions 1.1.5 
language-debian 0.2.1 
language-protobuf 0.7.1 
linter 3.2.3 
linter-pylama 0.10.1 
linter-shellcheck 1.6.0 
linter-ui-default 2.4.1 
merge-conflicts 1.4.5 
project-manager 3.3.8 
tabs-to-spaces 1.0.5 

Moderninzing import/export - Avoid dynamic require

I tried to build atom plugin using webpack, however because of the way the internal parts of this package call other functions (dynamic require), it fails to bundle.
Probably by using modern import/export the actual package will become faster too.

Uncaught TypeError: this.master.getCurrentIcon is not a function

Steps to reproduce:

  1. Open Atom
  2. see an ugly error message

Atom: 1.33.1 x64
Electron: 2.0.16
OS: Ubuntu 16.04.5
Thrown From: file-icons package 2.1.27

Stack Trace

Uncaught TypeError: this.master.getCurrentIcon is not a function

At /home/user/.atom/packages/file-icons/lib/service/icon-delegate.js:76

TypeError: this.master.getCurrentIcon is not a function
    at IconDelegate.getClasses (/packages/file-icons/lib/service/icon-delegate.js:76:18)
    at IconNode.refresh (/packages/file-icons/lib/service/icon-node.js:79:39)
    at IconNode.disposables.add.delegate.onDidChangeIcon (/packages/file-icons/lib/service/icon-node.js:33:40)
    at Function.simpleDispatch (/snap/atom/209/usr/share/atom/resources/app/static/<embedded>:11:1189948)
    at Emitter.emit (/snap/atom/209/usr/share/atom/resources/app/static/<embedded>:11:1191389)
    at IconDelegate.emitIconChange (/packages/file-icons/lib/service/icon-delegate.js:61:17)
    at IconDelegate.set (/packages/file-icons/lib/service/icon-delegate.js:318:12)
    at to.onDidChangeMaster.to (/packages/file-icons/lib/service/icon-delegate.js:307:48)
    at Function.simpleDispatch (/snap/atom/209/usr/share/atom/resources/app/static/<embedded>:11:1189948)
    at Emitter.emit (/snap/atom/209/usr/share/atom/resources/app/static/<embedded>:11:1191389)
    at IconDelegate.set (/packages/file-icons/lib/service/icon-delegate.js:315:21)
    at /packages/file-icons/lib/service/icon-delegate.js:324:15)
    at disposables.add.resource.onDidChangeRealPath (/packages/file-icons/lib/service/icon-service.js:73:18)
    at Function.simpleDispatch (/snap/atom/209/usr/share/atom/resources/app/static/<embedded>:11:1189948)
    at Emitter.emit (/snap/atom/209/usr/share/atom/resources/app/static/<embedded>:11:1191389)
    at Directory.emit (/packages/file-icons/node_modules/atom-fs/lib/resource.js:100:17)
    at Immediate.setImmediate (/packages/file-icons/node_modules/atom-fs/lib/resource.js:260:28)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)

Non-Core Packages

atom-jinja2 0.6.0 
blackboard-bb-ui 0.3.0 
busy-signal 2.0.0 
editorconfig 2.2.2 
file-icons 2.1.27 
file-watcher 2.0.0 
intentions 1.1.5 
jslint 1.5.1 
language-dot 1.7.0 
language-ini 1.20.0 
language-restructuredtext 1.1.2 
linter 2.2.0 
linter-flake8 2.3.0 
linter-markdown 5.2.2 
linter-ui-default 1.7.1 
markdown-lists 0.0.2 
markdown-mindmap 0.6.1 
markdown-table-formatter 2.9.2 
pretty-json 2.0.3 
sort-lines 0.18.0 
teletype 0.13.3 

Assigned icon doesn't update when renaming file or folder.

Whenever the project's structure changes and things that once where files, now become folders (or I accidentally pressed 'A' instead of 'Shift-A' the first time...) from the tree-view the icon doesn't update accordingly.

To reproduce (using the built-in tree-view):

  • create a file (with any extension)
  • delete the file
  • create a folder with the same name as the old file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.