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

Imba icon #664

Closed
GavinRay97 opened this issue Oct 26, 2017 · 5 comments
Closed

Imba icon #664

GavinRay97 opened this issue Oct 26, 2017 · 5 comments
Labels
enhancement Feature requests or suggested improvements. new-icon New icons added to the package's icon-font.

Comments

@GavinRay97
Copy link
Contributor

GavinRay97 commented Oct 26, 2017

Hey, I was just curious whether or not you guys could add the Imba icon, a compile-to-JS language.

See:
https://github.com/somebee/imba
https://atom.io/packages/language-imba

I'm currently doing it right now through LESS in the stylesheet, feels really hacky. The language-imba package declares:

Scope: source.imba
File Types: imba

But yet despite this, the grammar being properly autodetected, and using a custom language definition in Atom's config coffeescript, I couldn't get the CSS selector to trigger. I don't think I should even need to declare it a custom file type because of the Scope and File Type from the language package, but I tried anways

  core:
    customFileTypes:
      "source.imba": [
        "imba"
      ]

Still just get:

<span class="name icon default-icon" title="test.imba" data-name="test.imba" data->test.imba</span>

So using this:

.icon[data-name$="imba"]:before{
  content: url('http://imba.io/images/logo.svg');
}

Unfortunately the SVG doesn't scale well at small dimensions, but what can you do?

Imba Atom Icon

Thank you guys!

Alhadis added a commit to file-icons/icons that referenced this issue Oct 26, 2017
@Alhadis
Copy link
Member

Alhadis commented Oct 26, 2017

Unfortunately the SVG doesn't scale well at small dimensions, but what can you do?

We have a dedicated repository where new icon requests can be submitted. I've already added an SVG for it in 09faaba, however, so there's no need to file a separate issue.

I don't think I should even need to declare it a custom file type because of the Scope and File Type from the language package

Well... there is. The package's file-to-icon mappings are handled in config.cson... file-icons has no way of knowing what colour or icon class to assign a filetype, and a language package isn't going to enlighten it either.

@GavinRay97
Copy link
Contributor Author

Thank you for adding it!

The package's file-to-icon mappings are handled in config.cson... file-icons has no way of knowing what colour or icon class to assign a filetype, and a language package isn't going to enlighten it either.

I wasn't aware of this, how is it that picks up every other language's file types? Are all the other file types I work with just supported/recognized by Atom per default?

@Alhadis
Copy link
Member

Alhadis commented Oct 27, 2017

Nope, we manually declare the scope in the config file itself. See the documentation at the top of the file:

Name of any TextMate grammars which trigger the icon when overriding a file's grammar. This may be a string or regex; if provided the former, it's used to construct a case-insensitive pattern that's checked against the end of the string (e.g., "js" will be treated as if /.js$/i were written). Not every grammar will/should change an icon, especially for very generic formats like JSON or YAML.

However, the config also supports a shorthand. E.g., this line:

ANTLR:
	icon: "antlr"
	match: [
		[".g", "medium-red", "antlr"]
	]

... expands into this at compile-time:

ANTLR:
	icon: "antlr"
	match: [
		[".g", "medium-red", alias: "antlr", interpreter: "antlr", scope: "antlr"]
	]

In most cases, all three properties are identical, so the shorthand is sufficient for most cases.

It's becoming increasingly tempting to move the icon-config logic to a separate repository...

@GavinRay97
Copy link
Contributor Author

GavinRay97 commented Oct 27, 2017

Ahhh yeah, I feel like a moron, I was browsing the commit changes just now and saw the File Icons package config.cson and that you manually defined everything there, and had added an entry for the Imba file type.

Came back to strike out my comment and amend that I'm an idiot but you beat me to it. You're on top of things!

It's becoming increasingly tempting to move the icon-config logic to a separate repository...

I saw that discussion while trying to figure out how to implement the Icon without using LESS. I would advocate for it, just due to extensibility purposes honestly.

@GavinRay97
Copy link
Contributor Author

Edited

@Alhadis Alhadis added enhancement Feature requests or suggested improvements. new-icon New icons added to the package's icon-font. labels Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or suggested improvements. new-icon New icons added to the package's icon-font.
Projects
None yet
Development

No branches or pull requests

2 participants