sbarex / SourceCodeSyntaxHighlight

Quick Look extension for highlight source code files on macOS 10.15 and later.
GNU General Public License v3.0
2.98k stars 71 forks source link

Support additional TypeScript and JavaScript extensions #168

Closed tylerbrostrom closed 2 years ago

tylerbrostrom commented 2 years ago
Extension UTI Purpose
cjs com.netscape.javascript-source Signals to Node.js, “File is a CommonJS module.”
mts com.microsoft.typescript Signals to the TypeScript compiler, “File is an ECMAScript module.”
cts com.microsoft.typescript Signals to the TypeScript compiler, “File is a CommonJS module.”

Background

afaik, cjs has been a valid extension since Node.js 12.

The mts and cts, however, are brand-new extensions introduced in the upcoming TypeScript 4.7 release.

Happy to contribute a PR pending approval of the issue :)

sbarex commented 2 years ago

The com.netscape.javascript-source UTI is already managed by the application. This is the standard UTI for javascript, valid for extensions "js", "jscript", "javascript", "mjs".

What is the output of this Terminal command?

 mdls -name kMDItemContentTypeTree -name kMDItemContentType DRAG_HERE_A_CJS_FILE
tylerbrostrom commented 2 years ago

output for a cjs file:

kMDItemContentType     = "dyn.ah62d4rv4ge80g4xx"
kMDItemContentTypeTree = (
    "public.item",
    "dyn.ah62d4rv4ge80g4xx",
    "public.data"
)
eshimischi commented 2 years ago

Also curious about adding support for named extensions cause all of em are already a standard

sbarex commented 2 years ago

Unfortunately .mts format is recognized as a video file (UTI public.avchd-mpeg-2-transport-stream).

sbarex commented 2 years ago

Implemented on release 2.1.12 (61)

tylerbrostrom commented 2 years ago

Thanks!