Python test files are not marked with the test icon when they contain a python shebang
demmerichs opened this issue · comments
Hey, first of all, great job on this package. Although a "simple" feature, it is definitely helpful.
However, I like to have shebangs in all script files, however when writing test scripts for Python the shebang #!/usr/bin/env python3
seems to make the difference in the icon selection for this script which seems to me a bit counterintuitive. Is there something I can do about that might not involve deleting all shebangs from the files?
Hashbangs have greater precedence than filenames when selecting an icon, so an executable like ./configure
doesn't receive a config-icon. Most of the time, this is desirable. However, an unfortunate limitation is being unable to associate a language or interpreter with more than one icon. The current implementation maps them to icons using interpreter
and scope
properties declared in config.cson
, but is unable to map more than one icon at a time. This is probably my biggest gripe with the way I designed this; a rewrite is planned, but not due in the near future, so for the time being, you'll need to use your stylesheet:
// Match an absolute path:
[data-path^="/path/to/test/directory"],
// Match any path containing a directory named "test"
[data-path*="/test/"],
// Match any filename containing “-spec.” or “-test.”:
[data-name*="-spec."],
[data-name*="-test."]
{
// Match filenames ending in:
&[data-name$=".py"],
&[data-name$=".py3"],
&[data-name$=".python"]{
// Finally, style the actual icon
&::before{
font: 17px file-icons;
content: "\ea66";
top: 3px;
}
}
}
Is this a pain in the arse? Yes, you're goddamn right it is. Hell, even I had to resort to this hack. I think I might make an ad-hoc exception to the hashbang strategy to exempt test-files, because this is pretty ridiculous...
Thanks a lot, this is working for me!