Skip to content

Commit a7e0a21

Browse files
committed
Simplify generation of language-name regexes
In an ongoing effort to make this project's format database less hostile towards ports and third-party integrations, a dubious novelty introduced in v2 has been removed: the supposed "fuzzy" matching of language names. This feature attempted to maximise the perceived "accuracy" of generated expressions by substituting non-alphabetic sequences with ones that were more likely to match something unambiguous: 1. Word boundaries would match `[\W_ \t]?` instead of a space or dash, 2. Zeroes would match the letter "O" (and vice versa), 4. Punctuation in the original string was made optional, and 3. Words with medial caps were blindly assumed to be camelCased, which resulted in poor handling of names with non-standard capitalisation (e.g., "ECLiPSe"). This "promiscuous" matching is problematic for the import script used by the VSCode port, which enumerates the possibilities of finite regexes to generate a flat list of names for JSON encoding. Moreover, its relevance in Atom is questionable at best; at worst, hopelessly counter-intuitive. Aside from eliminating the aforementioned behaviour, this commit updates the compiler logic to retain an icon-name's original case when possible, even though the resulting expression is case-insensitive. This gives one more permutation of capitalisation to use in VSCode, which matches names case-sensitively.
1 parent 859b5c7 commit a7e0a21

7 files changed

Lines changed: 427 additions & 493 deletions

File tree

config.cson

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ fileIcons:
375375
icon: "as"
376376
match: [
377377
[".swf", "medium-blue"]
378-
[".as", "medium-red", scope: /\.(flex-config|actionscript(\.\d+)?)$/i, alias: /^(ActionScript\s*3|as3)$/i]
378+
[".as", "medium-red", scope: /\.(flex-config|actionscript(\.[1-3])?|as3)$/i, alias: /^(Action[-_ ]?Script[-_ ]?[1-3]|as3)$/i]
379379
[".jsfl", "auto-yellow"]
380380
[".swc", "dark-red"]
381381
]
@@ -709,29 +709,33 @@ fileIcons:
709709
match: ".agc"
710710
colour: "dark-blue"
711711
scope: "source.agc"
712-
alias: /^(Virtual\s*)?AGC$|^Apollo([-_\s]*11)?\s*Guidance\s*Computer$/i
712+
alias: ["Virtual AGC", "AGC", "Apollo 11", "Apollo 11", "Apollo 11 Guidance Computer"]
713713
uses: "Assembly"
714+
generic: yes
714715

715716
"Assembly, ARM":
716717
icon: "asm-arm"
717718
match: ".arm"
718719
colour: "medium-blue"
719720
scope: "arm"
720721
uses: "Assembly"
722+
generic: yes
721723

722724
"Assembly, AVR":
723725
icon: "asm-avr"
724726
match: ".avr"
725727
colour: "dark-purple"
726728
scope: /(^|\.)avr(dis)?asm(\.|$)/i
727729
uses: "Assembly"
730+
generic: yes
728731

729732
"Assembly, Hitachi":
730733
icon: "asm-hitachi"
731734
match: /\.h8(SX?|\d{3})?$/i
732735
colour: "medium-grey"
733736
alias: /^(h8(SX?|\/?\d{3})?)$/i
734737
uses: "Assembly"
738+
generic: yes
735739

736740
"Assembly, Intel":
737741
icon: "asm-intel"
@@ -740,10 +744,12 @@ fileIcons:
740744
scope: /(^|\.)((x|i(a[-_]?))(32|86|64)(asm)?|i386|80386)(\.|$)/i
741745
alias: /^(x86|x64|x86[-_]?64|i(a[-_]?)?(32|64)|i386|80386|Intel|Itanium|[ftm]asm)$/i
742746
uses: "Assembly"
747+
generic: yes
743748

744749
"Assembly, Motorola":
745750
icon: "asm-m68k"
746751
uses: "Assembly"
752+
generic: yes
747753
match: [
748754
[".m68k", "dark-red", alias: /^(asm68(k|\d{2,3})?|m68k)$/i, scope: /(^|\.)(m68k|dasm)(\.|$)/i]
749755
[".lst", "medium-blue", alias: "lst-cpu12", scope: /(^|\.)(lst-)?cpu[-_\s]?12(\.|$)/i]
@@ -753,12 +759,14 @@ fileIcons:
753759
icon: "asm-vax"
754760
match: /\.v(ax|masm)$/i
755761
colour: "medium-maroon"
756-
alias: /^(Macro[-_\s]?32|VAX\s+Macro|vmasm)$/i
762+
alias: ["Macro 32", "VAX Macro", "vmasm"]
757763
uses: "Assembly"
764+
generic: yes
758765

759766
"Assembly, Zilog":
760767
icon: "asm-zilog"
761768
uses: "Assembly"
769+
generic: yes
762770
match: [
763771
[".z80", "medium-yellow", scope: "z80"]
764772
[/\.PLX(COPY)?$/, "medium-blue",
@@ -1141,7 +1149,7 @@ fileIcons:
11411149
BYOND: # Dream Maker Script
11421150
icon: "byond"
11431151
scope: "dm"
1144-
alias: /^(DM|Dream\s*Maker(\s*Script)?)$/i
1152+
alias: ["DM", "Dream Maker", "Dream Maker Script"]
11451153
match: ".dm"
11461154
colour: "medium-blue"
11471155

@@ -1173,7 +1181,7 @@ fileIcons:
11731181
"C#":
11741182
icon: "csharp"
11751183
scope: "cs"
1176-
alias: /^c\s*sharp$/i
1184+
alias: ["C♯", "C Sharp"]
11771185
match: ".cs"
11781186
colour: "auto-blue"
11791187

@@ -1460,7 +1468,7 @@ fileIcons:
14601468
CoffeeScript:
14611469
icon: "coffee"
14621470
match: [
1463-
[".coffee", "medium-maroon", scope: "coffee", alias: /^Coffee(-Script)?$/i, interpreter: "coffee", tag: "coffee"]
1471+
[".coffee", "medium-maroon", scope: "coffee", alias: /^Coffee([-_ ]Script)?$/i, interpreter: "coffee", tag: "coffee"]
14641472
[".cjsx", "dark-maroon"]
14651473
[".coffee.ecr", "medium-cyan", priority: 2]
14661474
[".coffee.erb", "medium-red", priority: 2]
@@ -1472,8 +1480,8 @@ fileIcons:
14721480
ColdFusion:
14731481
icon: "cf"
14741482
match: [
1475-
[".cfc", "light-cyan", scope: "cfscript", alias: /^(CFC|CFScript)$/i]
1476-
[/\.cfml?$/i, "medium-cyan", scope: /\.cfml?$/i, alias: /^(cfml?|ColdFusion\s*HTML)$/i]
1483+
[".cfc", "light-cyan", scope: "cfscript", alias: ["CFC", "CFScript"]]
1484+
[/\.cfml?$/i, "medium-cyan", scope: /\.cfml?$/i, alias: ["cfml", "ColdFusion HTML"]]
14771485
]
14781486

14791487
COLLADA:
@@ -1975,7 +1983,7 @@ fileIcons:
19751983
icon: "icon-star"
19761984
match: ".dmark"
19771985
colour: "dark-red"
1978-
alias: /^d[_\W]?mark$/i
1986+
alias: /^D[-_ *★]?Mark$/i
19791987
noSuffix: true
19801988

19811989
Deno:
@@ -2714,7 +2722,7 @@ fileIcons:
27142722
[".befunge", "medium-orange"]
27152723
[".bmx", "dark-blue"]
27162724
[".brs", "dark-blue", "brightscript"]
2717-
[".capnp", "dark-red", scope: "capnp", alias: /^(Cap[^\w\s]?n\s*Proto|capnp)$/i]
2725+
[".capnp", "dark-red", scope: "capnp", alias: /^(Cap['‘’]?n[-_ ]?Proto|capnp)$/i]
27182726
[".ccxml", "dark-blue"]
27192727
[".cscfg", "medium-red"]
27202728
[".cgi", "medium-red"]
@@ -3601,7 +3609,7 @@ fileIcons:
36013609
Junos:
36023610
icon: "junos"
36033611
match: [
3604-
[".jos", "medium-cyan", scope: "junos", alias: /^(Juniper\W*)Jun\s*os(\W*Config)?$/i]
3612+
[".jos", "medium-cyan", scope: "junos", alias: /^Juniper[-_ ]?Jun\s*os([-_ ]?Config)?$/i]
36053613
[".slax", "medium-blue", "slax"]
36063614
]
36073615

@@ -3717,7 +3725,7 @@ fileIcons:
37173725

37183726
Kusto:
37193727
icon: "kusto"
3720-
alias: /Kusto (Query.?Language|Explorer)|^KQL$/i
3728+
alias: /Kusto (Query[-_ ]?Language|Explorer)|^KQL$/i
37213729
match: /\.(csl|kusto)$/i
37223730
colour: "medium-blue"
37233731
scope: "source.kusto"
@@ -5185,7 +5193,7 @@ fileIcons:
51855193
icon: "pico8"
51865194
match: ".p8"
51875195
colour: "medium-red"
5188-
alias: /^pico\W8$/i
5196+
alias: /^pico[-_ ]?8$/i
51895197
interpreter: "pico-8"
51905198
signature: /^pico-8 cartridge \/\/ http:\/\/www\.pico-8\.com$/
51915199
scope: "p8"
@@ -6386,7 +6394,7 @@ fileIcons:
63866394
colour: "medium-green"
63876395
priority: 2
63886396

6389-
StyledComponent:
6397+
"Styled Component":
63906398
icon: "nailpolish"
63916399
priority: 2
63926400
match: [
@@ -6572,7 +6580,7 @@ fileIcons:
65726580
icon: "test-generic"
65736581
match: [
65746582
[/([\\/])t\1t?\d+(?:(?!\1).)+\.sh$|[._-](spec|test)s?\.sh$/i, "medium-green", matchPath: true, priority: 1.5, tag: "genericTest"]
6575-
[".bats", "auto-grey", interpreter: "bats", alias: "Bats", url: "https://github.com/bats-core/bats-core", uses: "Shell", scope: "bats"]
6583+
[".bats", "auto-grey", interpreter: "bats", alias: "Bats", url: "https://github.com/bats-core/bats-core", uses: "Shell", scope: "bats", generic: yes]
65766584
[".test", "medium-green", priority: 0.25]
65776585
[".xspec", "dark-green"]
65786586
]

0 commit comments

Comments
 (0)