Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

Commit

Permalink
Add support for more Xcode files
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmeuli committed May 23, 2020
1 parent feb9029 commit 9052904
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 25 deletions.
10 changes: 8 additions & 2 deletions QLPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,20 @@
<string>public.tab-separated-values-text</string> <!-- .tsv -->

<!-- Code / plain text -->
<string>com.adobe.jsx</string> <!-- .jsx (used for React instead of ExtendScript -->
<string>com.adobe.jsx</string> <!-- .jsx (used for React instead of ExtendScript) -->
<string>com.apple.applescript.script-bundle</string> <!-- .scptd (AppleScript bundle) -->
<string>com.apple.applescript.script</string> <!-- .scpt (AppleScript binary) -->
<string>com.apple.applescript.text</string> <!-- .applescript (AppleScript text file) -->
<string>com.apple.disk-image-dart</string> <!-- .dart (used for Google's programming language instead of Apple's Disk Archive/Retrieval Tool) -->
<string>com.apple.dt.document.scheme</string> <!-- .xcscheme (Xcode schemes) -->
<string>com.apple.dt.interfacebuilder.document.storyboard</string> <!-- .storyboard (Xcode Storyboard) -->
<string>com.apple.interfacebuilder.document.cocoa</string> <!-- .xib (Xcode XIB) -->
<string>com.apple.rez-source</string> <!-- .r -->
<string>com.apple.rez-source</string> <!-- .r (used for R instead of Apple's Rez) -->
<string>com.apple.xcode.entitlements-property-list</string> <!-- .entitlements -->
<string>com.apple.xcode.strings-text</string> <!-- .strings (Apple Strings Resource File) -->
<string>com.apple.xcode.projectdata</string> <!-- .pbxproj (Xcode project data) -->
<string>com.apple.xcode.strings-dictionary</string> <!-- .stringsdict (Xcode Stringsdict) -->
<string>com.apple.xcode.strings-text</string> <!-- .strings (Xcode Strings Resource) -->
<string>com.barebones.bbedit.ini-configuration</string> <!-- .cfg -->
<string>com.barebones.bbedit.scss-source</string> <!-- .scss -->
<string>com.barebones.bbedit.tex-source</string> <!-- .tex -->
Expand Down Expand Up @@ -200,6 +205,7 @@
<string>public.json</string> <!-- .json -->
<string>public.ksh-script</string> <!-- .ksh (KornShell) -->
<string>public.make-source</string> <!-- .mak (Makefile) -->
<string>public.module-map</string> <!-- .modulemap (Clang module map) -->
<string>public.objective-c-source</string> <!-- .m (Objective-C) -->
<string>public.opencl-source</string> <!-- .cl (OpenCL) -->
<string>public.pascal-source</string> <!-- .pas (Pascal) -->
Expand Down
58 changes: 35 additions & 23 deletions QLPlugin/Views/Previews/CodePreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,54 @@ import Foundation
import os.log

let dotfileLexers = [
".bashrc": "bashrc",
// Files with syntax supported by Chroma
".bashrc": ".bashrc",
".vimrc": ".vimrc",
".zprofile": "zsh",
".zshrc": ".zshrc",
"dockerfile": "Dockerfile",
"gemfile": "Gemfile",
"gnumakefile": "Makefile",
"makefile": "Makefile",
"pkgbuild": "PKGBUILD",
"rakefile": "Rakefile",

// Files for which a different, similar syntax is used
".dockerignore": "bash",
".editorconfig": "ini",
".gitattributes": "bash",
".gitconfig": "ini",
".gitignore": "bash",
".npmignore": "bash",
".vimrc": "vim",
".zprofile": "zsh",
".zsh_history": "txt",
".zshrc": "zshrc",
"dockerfile": "Dockerfile",
"gemfile": "Gemfile",
"gnumakefile": "Makefile",
"makefile": "Makefile",
"pkgbuild": "pkgbuild",
"rakefile": "Rakefile",
]

let fileExtensionLexers = [
"alfredappearance": "json", // Alfred theme
"cls": "tex", // LaTeX classes file
// Files with syntax supported by Chroma
"alfredappearance": "json",
"cls": "tex",
"entitlements": "xml",
"hbs": "handlebars", // Handlebars template
"hbs": "handlebars",
"iml": "xml",
"liquid": "twig", // Liquid template
"njk": "twig", // Nunjucks template
"plist": "xml",
"resolved": "json", // Swift Package Manager lockfile (Package.resolved)
"scpt": "applescript", // AppleScript binary
"scptd": "applescript", // AppleScript bundle
"spf": "xml", // Sequel Pro query favorites file
"spTheme": "xml", // Sequel Pro theme file
"strings": "c", // Apple Strings Resource File
"sty": "tex", // LaTeX styles file
"webmanifest": "json", // Web app manifest
"resolved": "json",
"scpt": "applescript",
"scptd": "applescript",
"spf": "xml",
"spTheme": "xml",
"storyboard": "xml",
"stringsdict": "xml",
"sty": "tex",
"webmanifest": "json",
"xcscheme": "xml",
"xib": "xml",

// Files for which a different, similar syntax is used
"liquid": "twig",
"modulemap": "hcl",
"njk": "twig",
"pbxproj": "txt",
"strings": "c",
]

class CodePreview: Preview {
Expand Down

0 comments on commit 9052904

Please sign in to comment.