A tool to generate source code QuickLook previews for macOS Catalina and above

Latest Release: 1.3.2

 

How to Use PreviewCode

Install the app and run it. This will register the availability of the app’s QuickLook extensions, Code Previewer and Code Thumbnailer. You can now quit the app — just click Quit:

The PreviewCode main UI

To use QuickLook in Finder, select a source code file and press space. This will pop up a rendered preview of the file, using a dark theme…

A dark-theme PreviewCode preview

…or a light theme…

A light-theme PreviewCode preview

…the choice is yours — make your selection in the main app’s Preferences panel.

Various PreviewCode themes

You’ll also get source code file previews in Finder’s preview pane, enabled using View > Show Preview or by hitting Cmd-Shift-P. PreviewCode enables syntax highlighted previews in the Preview: section of Finder’s file info panel (select a file and hit Cmd-I), too.

You can disable or re-enable Code Previewer and/or Code Thumbnailer in System Preferences > Extensions:

macOS Ventura system settings for extensions

Supported Languages and Data

Compiled Languages

  • ActionScript (.actionscript)
  • Ada (.ads, .adb)
  • AppleScript (.applescript)
  • Arduino (.arduino, .ino)
  • Basic (.basic, .bas)
  • Brainfuck (.brainfuck, .b, .bf)
  • C (.c, .h)
  • C++ (.cpp, .hpp)
  • C# (.csx, .cs, .c-sharp, .csharp)
  • Clojure (.clojure, .clj, .cljc, .cljs)
  • CoffeeScript (.coffee, .coffeescript, .litcoffee)
  • Dart (.dart)
  • Elixir (.elxir, .ex, .exs)
  • Elm (.elm)
  • Erlang (.erlang, .erl, .hrl)
  • Fortran (.for)
  • F# (.fsharp, .f-sharp, .fsi, .fsx, .fsscript)
  • Go (.go)
  • GameMaker Language (.gml)
  • Haskell (.haskell, .hs, .lhs)
  • Java (.java)
  • JavaScript (.js)
  • Julia (.julia, .jl)
  • Kotlin (.kotlin, .kt, .ktm, .kts)
  • Lisp (.lisp, .lsp, .fasl)
  • Lua (.lua)
  • Objective-C (.m)
  • Pascal (.pas)
  • Perl (.perl)
  • PHP (.php)
  • Python (.py)
  • Ruby (.rb)
  • Rust (.rs, .rust)
  • Swift (.swift)
  • TypeScript (.typescript, .tsx, .ts)
  • Visual Basic Script (.vbscript, .vbe, .vbs, .wsc, .wsf)
  • Vue.js (.vue)

Shell Scripting

  • Bash (.sh)
  • C Shell (.csh)
  • Korn Shell (.ksh)
  • TCSH (.tsch)
  • Z Shell (.zsh)

Assembly

  • ARM Assembler (.s)
  • x86-64 Assembler (.asm, .nasm)

Others

  • Apple Property list files (.plist)
  • Apple Entitlements files (.entitlements)
  • Apple Xcode NIB files (.xib)
  • Apple Xcode storyboard files (.storyboard)
  • AsciiDoc (.asciidoc, .adoc, .asc)
  • Config files (.conf, .cf, .cfg, .ini, .rc)
  • Cmake files (.cmake)
  • CSS (.css)
  • Enviroment (.env)
  • LaTex (.latex, .tex)
  • Makefiles (makefile)
  • Protobuf (.proto)
  • SASS/SCSS (.scss, .sass)
  • SQL script (.sql)
  • Terraform source file (.tf, .terraform)
  • Terraform variable file (.tfvars)
  • Twig (.twig)

Customise the Preview

Open the Preferences panel from the main app’s PreviewCode menu, by hitting Command-,, or by clicking the Show Preview Preferences button. This Preferences panel allows you to adjust some of the key elements of the preview:

  • The preview’s font — choose from any monospace font installed on your Mac.
  • The preview’s font style.
  • The preview’s text size, from 10pt to 28pt.
  • The preview theme.

PreviewCode allows you to choose a light theme, a dark theme, or one of each and use macOS’ current UI mode to apply one of them appropriately. Check the Theme Mode option you prefer, and then select your theme(s) from the list.

For example, to always show code in a light theme, whatever mode your Mac’s UI is set to, check Light and then select a light theme:

Light theme selection in PreviewCode

Alternatively, to always show code in a dark theme, no matter what mode your Mac’s UI is set to, check Dark and then select a dark theme:

Dark theme selection in PreviewCode

In each of these cases, PreviewCode will only show themes of the selected type. However, if you check Auto, you will be able to select one light theme and one dark theme from a list of all themes. PreviewCode will then apply the theme that matches your Mac’s current UI mode:

Auto theme selection in PreviewCode

Your Mac may be set to light mode or dark mode, or to automatically change according to the time of day. You make this choice in System Settings > Appearance.

Click Save to apply your choices.

Changing these settings will affect previews straight away.


Feedback and Bug Reports

You can use the main app to submit feedback. Just click in the Send Feedback button in the main app, or select Report a Bug… from its Help menu:

The PreviewCode app feedback mechanism

Please include your email address if you would like a response. I can’t respond without one. Please see the privacy policy for details of email address usage.


Troubleshooting

If it appears that either Code Previewer or Code Thumbnailer are not working after you have run the host app, please log out of your Mac and then log back in.

Known Issues

  • PreviewCode will not render Clojure .edn files. This is because the .edn file extension is pre-set on macOS to an Adobe digital rights management product.
  • PreviewCode will not render TypeScript .ts files. This is because the .ts file extension is pre-set on macOS to MPEG-2 transport stream video files.
  • PreviewCode will not render Elixir .exs files if GarageBand and/or Logic Pro is installed on your Mac. This is because these apps use this file extension for EXS24 instrument files.
  • Previews displayed on external displays, or on Macs with connected to multiple monitors, may intermittently not be scrollable if you’re using a third-party mouse. Workaround: a MacBook’s built-in trackpad will be able to scroll.
  • Deselecting code in the preview is not immediate: the highlight clears after ~1s. We are investigating fixes.

Enjoyed Using PreviewCode?

If you have found PreviewCode to be useful, please consider writing a positive review on the Mac App Store, or simply give it a rating.

Thank you!


Acknowledgements

PreviewCode makes use of code from the following sources:


Source Code

You can view PreviewCode’s source code at GitHub.


Release Notes

  • 1.3.2 15 November 2023
    • Add the com.microsoft.typescript UTI.
    • Fix missing What’s New dialog.
    • Fix What’s New dialog ‘white flash’ in dark mode.
  • 1.3.1 14 August 2023
    • Non-shipping release for repo/code reorganisation.
  • 1.3.0 25 May 2023
    • Support automatic dark/light theme application by macOS UI mode.
    • Add line spacing control.
  • 1.2.7 31 March 2023
    • Support .elm Elm files.
    • Stop PreviewCode attempting to preview .scpt binary AppleScript files.
    • Under-the-hood improvements.
  • 1.2.6 22 March 2023
    • Allow text to be selected in previews.
    • Support .gml GML (GameMaker Language) files.
    • Support .vue Vue.js files.
    • Support .entitlements, .xib, .storyboard Xcode files.
    • Update to use HighlighterSwift 1.1.1.
  • 1.2.5 21 January 2023
    • Add link to PreviewText.
    • Better menu handling when panels are visible.
    • Better app exit management.
  • 1.2.4 14 December 2022
    • Add the com.microsoft.c-sharp UTI.
    • Support makefiles.
  • 1.2.3 2 October 2022
  • 1.2.2 26 August 2022
    • Initial support for non-utf8 source code file encodings.
    • Support XML Apple property list files (.plist).
    • Support the public.lua-script UTI.
  • 1.2.1 7 August 2022
    • Support the .cs C# extension.
    • Fix ARM assembly file display.
    • Fix operation of Preferences’ font style popup.
  • 1.2.0 26 April 2022
    • Update to use HighlighterSwift 1.1.0.
    • Support environment .env files.
    • Support CMake .cmake files.
    • Support Terraform variable .tfvars files.
    • Support AsciiDoc .adoc, .asciidoc and .asc files.
    • Support .conf, .cf, .cfg, .ini and .rc config files
    • Fix Haskell .hsl extension.
    • Fix x86 .nasm preview.
    • Change ActionScript supported extension to .actionscript to avoid clash with AppleSingle .as.
    • Remove Lisp .cl — clash with OpenCL source.
    • Remove Lisp .l — clash with Lex source.
    • Remove F# .fs — clash with OpenGL Fragment Shader source.
    • Remove Dylan .dylan and .lid extensions.
  • 1.1.1 19 November 2021
    • Support HashiCorp Terraform .tf files.
    • Disable selection of thumbnail tags under macOS 12 Monterey to avoid clash with system-added tags.
  • 1.1.0 28 July 2021
    • Improved font selection code.
    • Separate font style selection.
    • Accelerate loading of the Preferences panel, especially on Intel Macs.
    • Code streamlining.
    • Fixed a rare bug in the previewer error reporting code.
  • 1.0.0 17 June 2021
    • Initial public release.

Related Software


smittytonesmittytone
Site and software copyright © 2024, Tony Smith