Syntax-highlighted Quick Look previews for developer files on macOS. Select a
.rs, .ts, .tsx, .vue, .svelte, .go, .prisma, .graphql (and many more)
file in Finder, press Space, and see the code rendered with syntax highlighting
instead of a blank icon.
Built on the modern Quick Look Preview Extension API (QLPreviewingController) —
not a deprecated .qlgenerator plugin — and powered by
Highlightr (highlight.js).
- Syntax highlighting for dozens of languages via highlight.js.
- Automatic light/dark theme following the system appearance.
- Declares Uniform Type Identifiers for developer extensions macOS has no built-in type
for (
.ts,.tsx,.jsx,.vue,.svelte,.rs,.go,.prisma,.graphql,.toml,.kt,.dart,.sol,.zig,.lua, and more). - Large-file guard (previews truncate past 4 MB so Quick Look never stalls).
- macOS 14+
- Xcode 16+ (provides the toolchain and
swift-format) - XcodeGen (
brew install xcodegen)
project.yml XcodeGen spec — the source of truth for the Xcode project
.swift-format swift-format config (used by the editor and CI)
App/ Container app (SwiftUI window + setup instructions)
Info.plist UTImportedTypeDeclarations for extensions with no system type
PreviewExtension/ The Quick Look extension
PreviewViewController.swift Reads file -> Highlightr -> NSTextView
Info.plist QLSupportedContentTypes
QuickSource.xcodeproj is generated from project.yml and is git-ignored — regenerate
it with xcodegen generate.
xcodegen generate
# Signed build. Find your identity hash with:
# security find-identity -v -p codesigning
xcodebuild -project QuickSource.xcodeproj -scheme QuickSource \
-configuration Debug -destination 'platform=macOS' \
CODE_SIGN_STYLE=Manual \
CODE_SIGN_IDENTITY="<your-Apple-Development-cert-SHA1>" \
PROVISIONING_PROFILE_SPECIFIER="" DEVELOPMENT_TEAM="" \
build
# Install, register, launch once
rm -rf /Applications/QuickSource.app
cp -R ~/Library/Developer/Xcode/DerivedData/QuickSource-*/Build/Products/Debug/QuickSource.app /Applications/
open /Applications/QuickSource.appA Quick Look extension must be validly code-signed or macOS silently ignores it — an ad-hoc/unsigned build will not appear in Quick Look. A free Apple ID works.
- Run the app once (registers the extension).
- System Settings -> General -> Login Items & Extensions -> Quick Look -> enable PreviewExtension.
- Select a source file in Finder and press Space. Run
qlmanage -rto flush the Quick Look cache if an old preview is stuck.
- If the extension already has a system UTI conforming to
public.source-code(.swift,.py,.go,.rb,.php,.c,.js, …) it is already covered — just add a case inPreviewViewController.language(for:)for correct highlighting. - If it has no system UTI (
.ts,.vue,.prisma, …) add its extension to aUTImportedTypeDeclarationsentry inApp/Info.plist(conforming topublic.source-code), rebuild, and relaunch so Launch Services re-reads the types.
.ts is also the system type for MPEG-2 transport stream (video). The imported
declaration competes with that and the system type sometimes wins, so .ts may be treated
as video and skip the preview. .mts/.cts/.tsx are unaffected. Workaround: associate
.ts with a text editor via Finder -> Get Info -> Open with -> Change All.
Code is formatted with swift-format using the
committed .swift-format config:
xcrun swift-format lint --recursive App PreviewExtension # check
xcrun swift-format --in-place --recursive App PreviewExtension # fixMIT — see LICENSE.