Atom: Incorrect icon for 'news' in filename

Created on 6 Jan 2017  路  4Comments  路  Source: file-icons/atom

If the filename contains the word news it highlights it incorrectly
screen shot 2017-01-06 at 13 53 08

The line affecting this is here https://github.com/file-icons/atom/blob/master/lib/icons/.icondb.js#L1085

I cannot see what needs changing because the regex is correct and it doesn't know there is a .tpl on the end.

bug

All 4 comments

Hey @MaxGiting,

You've actually picked up on an important oversight in the matching engine. You're right, the regex is correct, but there's much more that's going on than running through an array of expressions.

TL;DR: My bad, will fix. Paste the Less snippet below until the next release.


Without delving too far into the internals, the matching process is controlled by Strategy objects, of which the PathStrategy is to blame for this. Now, the PathStrategy has a feature to strip irrelevant suffixes from patterns before matching. This pattern is still tested, it's just tested after existing expressions have been checked. This is so stuff like web-template.php.tpl or what-have-you will show a correct icon, whilst still permitting web-template.tpl to show a light-bulb for Smarty templates.

What I hadn't factored in was the possibility that such suffixes should be tested before the "last resort" rules are matched (which include stuff like *news*, *rc*, etc). Now, I realise this isn't a simple fix, because the priority of a "last-resort rule" isn't output by the generator (since it's really only relevant at compile-time). However, to fix this cleanly would involve knowing where "real" rules end and best guesses begin... so I need to amend the compiler code.

Thanks for this. I apologise for the inconvenience, it was a glaring oversight on my part. Until this is fixed in the next release, you can force lightbulbs to pop up with your stylesheet:

~less
.icon[data-name$=".tpl"]:before{
content: "f0eb";
font-family: FontAwesome;
font-size: 15px;
color: #d88511; // Omit this line if you're not using colours
}
~

HOW TO FIX SHIT, ALHADIS-STYLE

  1. Swap sleep to spend literally 9 hours writing an over-the-top solution
  2. Decide solution is crap and start over at 10am
  3. Write a simpler solution with stinging eyes that took ~10 minutes
  4. ????????
  5. Get job / profit

Nah.

Anyway, fixed.

Brilliant thank you!

My sleep-deprived pleasure!

Was this page helpful?
0 / 5 - 0 ratings