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

Perplexed: ".config" file not processed by default install/config on Catalina (10.15.7) #153

Closed taw123 closed 2 years ago

taw123 commented 2 years ago

First as someone who over the years has used a number of solutions BEFORE your creation(re-creation) I am quite impressed. I have used it for years and thank you for all the effort as a user and as a former former Evangelist at Apple in Dev Relations for MANY years!

Unfortunately the question. Though having used for a while and works for almost all files I would expect, I and a bug or much more likely I perhaps don't understand the internals and configuration as well as I suppose I should (or just a stupid error- happens to us all)...

I have a standard install of Syntax (close to current- 2.1.9) running on Catalina 10.15.7.

For some reason text based .config files are not being parsed by the QL extension inspire of my assumption that should be supported given the current readme.

Any thoughts? I would have thought if isn't were part of the standard support configuration that II would just need to add the UTI for my non loading file to your config (somehow) & add .config extension to the current ini profile (or whatever you call the config set for ini parsing)...

Thanks for any help you can offer.....


Configuration data below....

Sample file is confirmed to be pure txt

$ more /Volumes/DockerAppData/Qbit/qBitFlood-config/config/qBittorrent.conf 
[BitTorrent]
Session\Port=15746
Session\QueueingSystemEnabled=false

[Meta]
MigrationVersion=3

[Network]
Cookies=@Invalid()

[Preferences]
Downloads\SavePath=/config/downloads/
Downloads\TempPath=/config/downloads/temp/
WebUI\HostHeaderValidation=false
WebUI\LocalHostAuth=false
WebUI\Port=8480
WebUI\UseUPnP=false

File is NOT handled by Syntax:

Screenshot of QL for testing file, NOT showing Syntax parsing:

QL of test file

Metadata query for the test file:

mdls -name kMDItemContentType -name kMDItemContentTypeTree /Volumes/DockerAppData/Qbit/qBitFlood-config/config/qBittorrent.conf 
kMDItemContentType     = (null)
kMDItemContentTypeTree = (null)

Syntax Inquiry command of the file shows 3 potential associated UTI: (screenshot attached) Unfortunately I can't distinguish the color indicator you chose to to show Support & Handled vs Potentially supported but not handled (btw I worked for years to make sure the Apple HI Team always included color-blind/alternate color indicators... (long before accessibility became a thing, which is one reason the server manager UI allowed for a display with color or shapes) But I digress....

Inquiry of test file

QL dump of Syntax: (showing that org.sbarex.conf, com.macromates.textmate.scheme, com.macromates.textmate.standard-ml are all supported but no listing for com.coderunnerapp)

pluginkit -m -i org.sbarex.SourceCodeSyntaxHighlight.QuicklookExtension --raw
<OS_xpc_dictionary: <dictionary: 0x7f9379c0a8d0> { count = 1, transaction: 0, voucher = 0x0, contents =
    "matches" => <dictionary: 0x7f9379c09980> { count = 1, transaction: 0, voucher = 0x0, contents =
        "ECF19A18-7AA6-4141-B4DC-A2E5123B2B5C" => <data: 0x7f9379c09850>: { length = 28672 bytes, contents = 0x62706c697374313513a3210000000000801200000000a1df... }
    }
}>
(
        {
        annotations =         {
            election = 1;
            extension =             {
                lastDateManagedOn = "2022-02-20 23:18:31 +0000";
            };
        };
        bundleInfo =         {
            BuildMachineOSBuild = 21D62;
            CFBundleDevelopmentRegion = en;
            CFBundleExecutable = "Syntax Highlight Quicklook Extension";
            CFBundleIdentifier = "org.sbarex.SourceCodeSyntaxHighlight.QuicklookExtension";
            CFBundleInfoDictionaryVersion = "6.0";
            CFBundleName = "Syntax Highlight Quicklook Extension";
            CFBundlePackageType = "XPC!";
            CFBundleShortVersionString = "2.1.9";
            CFBundleSupportedPlatforms =             (
                MacOSX
            );
            CFBundleVersion = 57;
            LSExecutableMinimumOSVersion = "10.15";
            LSExecutablePlatformKey = 1;
            LSExecutableSDKVersion = "12.1";
            LSMinimumSystemVersion = "10.15";
            MachOUUIDs =             (
                "ED819DEB-5A86-3575-BC3D-1FB98E2FFD85",
                "136DACC7-25AA-3E59-8ACC-7CD6D88A4527"
            );
            NSExtension =             {
                NSExtensionAttributes =                 {
                    NSExtensionPointName = "com.apple.quicklook.preview";
                    NSExtensionPointVersion = "1.0";
                    NSExtensionVersion = "2.1.9";
                    QLIsDataBasedPreview = 1;
                    QLSupportedContentTypes =                     (
                        "com.adobe.acrobat.sequ",
                        "com.adobe.actionscript",
                        "com.adobe.coldfusion",
                        "com.adobe.jsx",
                        "com.adobe.edn",
                        "com.apple.applescript.script",
                        "com.apple.applescript.text",
                        "com.apple.binary-property-list",
                        "com.apple.dt.document.ascii-property-list",
                        "com.apple.dt.interfacebuilder.document.storyboard",
                        "com.apple.interfacebuilder.document.cocoa",
                        "com.apple.property-list",
                        "com.apple.rez-source",
                        "com.apple.terminal.settings",
                        "com.apple.terminal.shell-script",
                        "com.apple.xcode.entitlements-property-list",
                        "com.apple.xcode.strings-dictionary",
                        "com.apple.xcode.strings-text",
                        "com.apple.xml-property-list",
                        "com.barebones.bbedit.go-source",
                        "com.barebones.bbedit.ini-configuration",
                        "com.barebones.bbedit.jsp-source",
                        "com.barebones.bbedit.lua-source",
                        "com.barebones.bbedit.r-source",
                        "com.barebones.bbedit.rust-source",
                        "com.barebones.bbedit.scss-source",
                        "com.barebones.bbedit.sql-source",
                        "com.barebones.bbedit.tex-source",
                        "com.barebones.bbedit.typescript-source",
                        "com.barebones.bbedit.vbscript-source",
                        "com.barebones.bbedit.verilog-hdl-source",
                        "com.barebones.bbedit.vhdl-source",
                        "com.dhowett.logos",
                        "com.eiffel.eiffelstudio-project-config",
                        "com.eiffel.source-code",
                        "com.google.earth.kml",
                        "com.jetbrain.source",
                        "com.macromates.textmate.scheme",
                        "com.macromates.textmate.standard-ml",
                        "com.microsoft.asp",
                        "com.microsoft.csharp-source",
                        "com.microsoft.c-sharp",
                        "com.microsoft.f-sharp",
                        "com.microsoft.ini",
                        "com.microsoft.typescript",
                        "com.microsoft.vb-source",
                        "com.microsoft.visual-basic",
                        "com.microsoft.xaml",
                        "com.netscape.javascript-source",
                        "com.sass-lang.sass",
                        "com.sun.java-properties",
                        "com.sun.java-source",
                        "com.sun.java-server-pages",
                        "com.sun.java-web-start",
                        "com.sun.javafx",
                        "com.sun.java-class",
                        "com.sun.manifest",
                        "com.unknown.lhs",
                        "com.seriflabs.xmp",
                        "com.symfony.twig",
                        "dev.svelte.source",
                        "edu.uo.texshop.tex",
                        "info.haml.haml",
                        "io.azkaban.flow",
                        "io.github.jsx",
                        "is.workflow.my.workflow",
                        "org.applescript.source",
                        "org.arduino.ino-source",
                        "org.arduino.source",
                        "org.asm.source",
                        "org.bash.source",
                        "org.clojure",
                        "org.cmake.makefile",
                        "org.cmake.cmake",
                        "org.clojure.script",
                        "org.cocoapods.podspec",
                        "org.codehaus.groovy-source",
                        "org.coffee.source",
                        "org.coffeescript.coffeescript",
                        "org.cson.source",
                        "org.dartlang.dart",
                        "org.emcascript.emcascript",
                        "org.erlang.erlang",
                        "org.erlang.erlang-source",
                        "org.elixir-lang.source",
                        "org.fish.source",
                        "org.gcc.files",
                        "org.go.source",
                        "org.golang.golang",
                        "org.gradle.source",
                        "org.haskell.haskell",
                        "org.haskell.haskell-source",
                        "org.haskell.literate-haskell-source",
                        "org.inno.source",
                        "org.iso.sql",
                        "org.julialang.julia",
                        "org.kmt.source",
                        "org.km3",
                        "org.kotlinlang.source",
                        "org.latex-project.latex",
                        "org.lesscss.less",
                        "org.lua.lua",
                        "org.lua.lua-source",
                        "org.microsoft.inf",
                        "org.nfo",
                        "org.n8gray.awk",
                        "org.n8gray.bat",
                        "org.n8gray.diff-script",
                        "org.n8gray.idl",
                        "org.n8gray.ini-source",
                        "org.n8gray.javaInstaller",
                        "org.n8gray.jsp-source",
                        "org.n8gray.lisp",
                        "org.n8gray.makefile",
                        "org.n8gray.railstemplate",
                        "org.n8gray.scheme-source",
                        "org.n8gray.standard-ml-source",
                        "org.n8gray.structured-query-language-source",
                        "org.n8gray.verilog",
                        "org.n8gray.vhdl",
                        "org.n8gray.xhtml",
                        "org.ocaml.ocaml",
                        "org.ocaml.ocaml-interface",
                        "org.ocaml.ocaml-source",
                        "org.omg.ecore",
                        "org.opml.opml",
                        "org.opml.source",
                        "org.pddl.pddl",
                        "org.python.compiled-script",
                        "org.racket-lang.source",
                        "org.rdf.source",
                        "org.rubygems.gemspec",
                        "org.ruby-lang.erb",
                        "org.rust-lang.rust",
                        "org.rust-lang.source",
                        "org.sbarex.conf",
                        "org.sbarex.dart",
                        "org.sbarex.ms-powershell",
                        "org.sbarex.ms-powershell-module",
                        "org.sbarex.ms-powershell-module-manifest",
                        "org.sbarex.nim",
                        "org.scala.source",
                        "org.tug.lua",
                        "org.tug.tex",
                        "org.tug.sty",
                        "org.vim.vim-script",
                        "org.vuejs.vue",
                        "org.w3.xsl",
                        "org.xml-tools.source",
                        "org.xsd.schema",
                        "org.xul.source",
                        "org.yaml.yaml",
                        "public.bash-script",
                        "public.csh-script",
                        "public.css",
                        "public.c-header",
                        "public.c-plus-plus-header",
                        "public.c-plus-plus-source",
                        "public.c-sharp-source",
                        "public.c-source",
                        "public.conf",
                        "public.content",
                        "public.data",
                        "public.data.xml.opml",
                        "public.diff",
                        "public.fortran-source",
                        "public.fortran-90-source",
                        "public.gd",
                        "public.ini",
                        "public.item",
                        "public.java",
                        "public.json",
                        "public.ksh-script",
                        "public.make-source",
                        "public.objective-c-source",
                        "public.objective-c-plus-plus-source",
                        "public.pascal-source",
                        "public.patch-file",
                        "public.perl-script",
                        "public.php-script",
                        "public.plain-text",
                        "public.properties",
                        "public.python-script",
                        "public.ruby-script",
                        "public.script",
                        "public.shell-script",
                        "public.source-code",
                        "public.swift-source",
                        "public.tcsh-script",
                        "public.tex",
                        "public.text",
                        "public.tsx",
                        "public.typescript",
                        "public.unix-executable",
                        "public.xml",
                        "public.yaml",
                        "public.zsh-script",
                        "tk.tcl.tcl",
                        "tk.tcl.tcl-source",
                        "dyn.ah62d4rv4ge8007a",
                        "dyn.ah62d4rv4ge8007dx",
                        "dyn.ah62d4rv4ge80c75p",
                        "dyn.ah62d4rv4ge80g62",
                        "dyn.ah62d4rv4ge80s52",
                        "dyn.ah62d4rv4ge80s6xbqv0gn",
                        "dyn.ah62d4rv4ge80w5pq",
                        "dyn.ah62d4rv4ge80y652",
                        "dyn.ah62d4rv4ge81g22",
                        "dyn.ah62d4rv4ge81g25brvuu",
                        "dyn.ah62d4rv4ge81g25xsq",
                        "dyn.ah62d4rv4ge80g55sq2",
                        "dyn.ah62d4rv4ge81k3p2",
                        "dyn.ah62d4rv4ge81a8p",
                        "dyn.ah62d4rv4ge81g6pq",
                        "dyn.ah62d4rv4ge81k55rru",
                        "dyn.ah62d46dzqm0gw23stb002svvhz6g45a",
                        "dyn.ah62d4rv4ge8086drru",
                        "dyn.ah62d4rv4ge80g5dn",
                        "dyn.ah62d4rv4ge80g5dnsq",
                        "dyn.ah62d4rv4ge80q5dts6",
                        "dyn.ah62d4rv4ge81a6xtsbw1e7dmqz3u",
                        "dyn.ah62d4rv4ge81g7xfrv4gn",
                        "dyn.ah62d4rv4ge81s3xqr75u",
                        "dyn.ah62d4rv4ge81u2prru",
                        "dyn.ah62d4rv4ge81u5pu",
                        "dyn.ah62d4rv4ge81a3deru",
                        "dyn.ah62d4rv4ge81e3pbqv00n",
                        "dyn.ah62d4rv4ge80c65r",
                        "dyn.ah62d4rv4ge81u65e",
                        "dyn.ah62d4rv4ge81u6pzqz3hw",
                        "dyn.ah62d4rv4ge81u6k",
                        "dyn.ah62d4rv4ge81u7k",
                        "dyn.ah62d4rv4ge80s3a"
                    );
                    QLSupportsSearchableItems = 0;
                };
                NSExtensionContextClass = QLPreviewExtensionContext;
                NSExtensionContextHostClass = QLPreviewHostExtensionContext;
                NSExtensionPointIdentifier = "com.apple.quicklook.preview";
                NSExtensionPrincipalClass = "Syntax_Highlight_Quicklook_Extension.PreviewViewController";
                NSExtensionProtocol = NSObject;
                PrincipalClass = NSObject;
                Subsystems =                 (
                    "NSSharingService_Subsystem",
                    "NSViewService_PKSubsystem"
                );
            };
            NSHumanReadableCopyright = "Developed by SBAREX (2019-2022).";
            Path = "/Applications/Syntax Highlight.app/Contents/PlugIns/Syntax Highlight Quicklook Extension.appex";
            XPCService =             {
                JoinExistingSession = 1;
                RunLoopType = "_NSApplicationMain";
                ServiceType = Application;
                "_AdditionalSubServices" =                 {
                    "apple-extension-service" = 1;
                    viewbridge = 1;
                };
            };
        };
        containingBundleIdentifier = "org.sbarex.SourceCodeSyntaxHighlight";
        containingPath = "/Applications/Syntax Highlight.app";
        discoveryInstanceUUID = "79EBD291-DC6B-4543-AC2A-DBFC7D5DAF0B";
        entitlements =         {
            "com.apple.security.app-sandbox" = 1;
            "com.apple.security.files.user-selected.read-only" = 1;
            "com.apple.security.get-task-allow" = 1;
            "com.apple.security.network.client" = 1;
            "com.apple.security.temporary-exception.files.absolute-path.read-only" =             (
                "/"
            );
            "com.apple.security.temporary-exception.mach-lookup.global-name" =             (
                "com.apple.nsurlsessiond",
                "com.apple.testmanagerd",
                "com.apple.dt.testmanagerd.runner",
                "com.apple.coresymbolicationd"
            );
        };
        extensions =         {
            "." = "2bcea3812a02809eb9a9b172eca9db2dfb4f171fa5455c1b99ceb428942c6209;00;00000000;00000000;00000000;000000000000001a;com.apple.app-sandbox.read;01;0100000a;0000000307ca42ad;01;/applications/syntax highlight.app/contents/plugins/syntax highlight quicklook extension.appex";
        };
        hubProtocolVersion = 2;
        identifier = "org.sbarex.SourceCodeSyntaxHighlight.QuicklookExtension";
        lastmodified = 1646673860;
        localizedContainingDisplayName = "Syntax Highlight";
        "original-identifier" = "org.sbarex.SourceCodeSyntaxHighlight.QuicklookExtension";
        path = "/Applications/Syntax Highlight.app/Contents/PlugIns/Syntax Highlight Quicklook Extension.appex";
        "service-extension" = "d3b1a2279e74df9c3380d935921c7671a2164ea988649ecb5ea0cb004fcfff0e;01;00000000;00000000;00000000;0000000000000022;com.apple.pluginkit.plugin-service;org.sbarex.SourceCodeSyntaxHighlight.QuicklookExtension";
        systemResident = 1;
        uuid = "F3E14E07-1C71-4478-8E88-5422775876E5";
        version = "2.1.9";
    }
)
sbarex commented 2 years ago

Hi, the problem is that in your system the .config files are linked to the UTI com.macromates.textmate.config-file which I don't currently handle.

Before releasing a new version I ask you to try the one I am attaching here to check if it works in your system.

To run it, replace the old version with this one and ctrl click on the icon and from the menu choose open and authorize the execution.

Syntax Highlight.zip

sbarex commented 2 years ago

The application has perhaps grown in a somewhat messy way, developed a little for fun, and needs to be updated from a graphical and usability point of view.

I never even considered the accessibility aspect. Maybe you could tell me which symbology to use to report Support & Handled vs Potentially supported formats. (For now there is the tooltip for the icon status).

taw123 commented 2 years ago

Success !! (though I of course did end up having to kick qlmanage (first -m then -r), followed by restarting the Finder before QL found the new build.

Screen Shot 2022-03-10 at 1 17 53 PM

While I was never an HI Engineer, sometimes even non-artists can be artistic... What was used for server Admin (since the pricked colors that were of equal brightness and saturation- a real sore spot for those with selective color vision), was a option to show each of the status indicators as shapes (circle=good/green, triangle=warning/yellow and square=error/stopped/red)... I only offer that as a suggestion to start the thought process.

Another approach you can also see from the original Aqua window controls (what we call "gumdrops"), take on a secondary UI when the mouse hovers over (long before Windows have "tooltips").

I hadn't realized you did this untill you mentioned (guess I was a bit to impatient when I originally tried hovering over the indicator, and thus sent the message about color accessibility. head smack

Screen Shot 2022-03-10 at 1 32 57 PM

One quick passing question I also noticed the MD files are not being processed by Syntax

Screen Shot 2022-03-10 at 1 40 55 PM

I didn't look to see if this is another case of Xcode or the OS taking precedence over everything else but thought I would mention it in passing in case it's a common question...

All the best and hanks again for the speedy response, and fix ! If ever I can help let me know... --T

sbarex commented 2 years ago

Generally for the new plugin to be recognized it is necessary to delete the old version (and also delete it from the recycle bin) and launch the new one. If it does not work in the system preferences / extensions / quicklook, the extension must be disabled and re-enabled.

qlmanage I doubt has any use for quicklook extensions (it is meant to work with thw qlgenerators thah uses the old deprecated api).

Markdown files are purposely unsupported as it would show syntax highlighting and not formatted text as most people would like.

For the markdown files I have however developed a special plugin (which if desired can be set to display the syntax instead of the formatting): QLMarkdown.

taw123 commented 2 years ago

While I did move the brew'd app (actually the link to the trash) and installed the link you provided (as well as refreshing/re-enabling System Preferences/QL), I didn't likely empty the trash as you mentioned... so perhaps that was why I had to relaunch the finder. Regardless as I said no worries.... And I've now added QLMarkdown to my arsenal! 👍

Given I think you pushed this change to release as 2.1.10 (59). I'm going to close this issue. Thanks again for everything.