How do you get the Finder preview to show the syntax colored code as seen in TextMate? This seemed to work automagically for an older bundle I created. I'm working a new bundle and the Finder only shows the generic document icon.
Thanks,
John DeSoi, Ph.D.
On 26 Jan 2020, at 22:58, John DeSoi wrote:
How do you get the Finder preview to show the syntax colored code as seen in TextMate? This seemed to work automagically for an older bundle I created. I'm working a new bundle and the Finder only shows the generic document icon.
If this is a new bundle, then it might for a type of file TextMate doesn’t claim responsibility for, so the system doesn’t know to use its Quick Look plug-in.
I’m not sure if it’s enough to just tell Finder to always open that type of file with TextMate, or if the app itself has to advertise support for it.
I assigned the file extension to always open with TextMate, but that did not help.
John DeSoi, Ph.D.
On Jan 31, 2020, at 7:39 AM, Rob McBroom mailinglist0@skurfer.com wrote:
On 26 Jan 2020, at 22:58, John DeSoi wrote:
How do you get the Finder preview to show the syntax colored code as seen in TextMate? This seemed to work automagically for an older bundle I created. I'm working a new bundle and the Finder only shows the generic document icon.
If this is a new bundle, then it might for a type of file TextMate doesn’t claim responsibility for, so the system doesn’t know to use its Quick Look plug-in.
I’m not sure if it’s enough to just tell Finder to always open that type of file with TextMate, or if the app itself has to advertise support for it.
I still have not figured it out, but this is interesting. If I save the file in BBEdit (space, backspace, save - no content change), it shows up in the Finder preview using the syntax coloring I defined in the TextMate bundle. But still no preview for other files with the same extension unless I re-save them. If I do the same save operation from TextMate, still no preview/quick look at all. Strange.
John DeSoi, Ph.D.
On Feb 2, 2020, at 7:53 AM, John DeSoi desoi@pgedit.com wrote:
I assigned the file extension to always open with TextMate, but that did not help.
John DeSoi, Ph.D.
On Jan 31, 2020, at 7:39 AM, Rob McBroom mailinglist0@skurfer.com wrote:
On 26 Jan 2020, at 22:58, John DeSoi wrote:
How do you get the Finder preview to show the syntax colored code as seen in TextMate? This seemed to work automagically for an older bundle I created. I'm working a new bundle and the Finder only shows the generic document icon.
If this is a new bundle, then it might for a type of file TextMate doesn’t claim responsibility for, so the system doesn’t know to use its Quick Look plug-in.
I’m not sure if it’s enough to just tell Finder to always open that type of file with TextMate, or if the app itself has to advertise support for it.
On 25 Feb 2020, at 10:36, John DeSoi wrote:
I still have not figured it out, but this is interesting. If I save the file in BBEdit (space, backspace, save - no content change), it shows up in the Finder preview using the syntax coloring I defined in the TextMate bundle. But still no preview for other files with the same extension unless I re-save them. If I do the same save operation from TextMate, still no preview/quick look at all. Strange.
It might be that BBEdit adds the four character type code to the file.
In a terminal try run this before/after saving with BBEdit: GetFileInfo -t <file>
Also, what extension does files (without) code preview have?
On May 10, 2020, at 8:25 PM, Allan Odgaard mailinglist@textmate.org wrote:
It might be that BBEdit adds the four character type code to the file.
In a terminal try run this before/after saving with BBEdit: GetFileInfo -t <file>
Yes! Before: "\0\0\0\0" and after: "TEXT"
Also, what extension does files (without) code preview have?
The file extension is ".4dm" which is a 4D method source file. It is part of a new text based project format 4D introduced with 4D 18:
https://doc.4d.com/4Dv18/4D/18/Exporting-structure-to-text-files.300-4575705...
4D forms are stored in .4DForm files which are really just JSON files. I added that extension to the JSON bundle and the .4DForm files properly show in the Finder preview. But they also show "\0\0\0\0" for GetFileInfo. I'm not seeing that my 4D bundle does anything different from the JSON bundle.
The 4D Info.plist info for these file types are included below. Thanks for any further insight to solving this.
John DeSoi, Ph.D.
<dict> <key>UTTypeConformsTo</key> <array> <string>public.source-code</string> </array> <key>UTTypeDescription</key> <string>4D Method</string> <key>UTTypeIdentifier</key> <string>com.4d.4d.method</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>4DMethod</string> <string>4dm</string> </array> </dict> </dict>
<dict> <key>UTTypeConformsTo</key> <array> <string>public.json</string> </array> <key>UTTypeDescription</key> <string>4D Form</string> <key>UTTypeIdentifier</key> <string>com.4d.4d.form</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>4DForm</string> </array> </dict> </dict>
On 11 May 2020, at 21:05, John DeSoi wrote:
4D forms are stored in .4DForm files which are really just JSON files. I added that extension to the JSON bundle and the .4DForm files properly show in the Finder preview. But they also show "\0\0\0\0" for GetFileInfo. I'm not seeing that my 4D bundle does anything different from the JSON bundle.
The stuff in the bundles does not affect Finder’s (or the system’s) treatment of files. For that, it must be in TextMate’s `Info.plist`.
But as 4D already have the correct definitions, this should not be necessary.
You can try to run `mdls «file»`, for example for `main.mm` I see this:
kMDItemContentType = "public.objective-c-plus-plus-source" kMDItemContentTypeTree = ( "public.objective-c-plus-plus-source", "public.source-code", "public.plain-text", "public.text", "public.data", "public.item", "public.content" )
This indicates that `.m` has been registered as conforming to `public.source-code` (which is one of the types handled by TextMate’s Quick Look plug-in).
As for `GetFile` / `SetFileInfo`, those are legacy, so while they do “fix” it, it’s not how it’s supposed to work.
All that said, in the last few days, both file type registration and Quick Look plug-in has stopped working on my own system (macOS 10.15).
For example for a .tex file I now get `dyn.ah62d4rv4ge81k3p2` as its `kMDItemContentType`.
I have tried to reset the launch services database, reboot, etc., but to no avail.
This system has always been a little flaky, but maybe with macOS 10.15 it is more flaky than usual…
Would you happen to see this on macOS 10.15 as well?
On May 15, 2020, at 10:12 PM, Allan Odgaard mailinglist@textmate.org wrote:
For example for a .tex file I now get dyn.ah62d4rv4ge81k3p2 as its kMDItemContentType.
That does seem to be the issue. For a .4dm file I get
kMDItemContentType = "dyn.ah62d4rv4ge8xk3dr" kMDItemContentTypeTree = ( "dyn.ah62d4rv4ge8xk3dr", "public.item", "dyn.ah62d4rv4ge8xk3dr", "public.data" )
I have tried to reset the launch services database, reboot, etc., but to no avail.
This system has always been a little flaky, but maybe with macOS 10.15 it is more flaky than usual…
Would you happen to see this on macOS 10.15 as well?
I'm having this issue on 10.14.6. But I copied the bundle another Mac running 10.15. In this case the mdls output looks completely correct, the text shows in the Finder preview, but it is not syntax colored. Same for other source files (js, json, etc), plain text shows up in Finder preview and quicklook, but it is not syntax colored. Rebooting did not help. qlmanage shows TextMate as the quicklook handler for public.source-code.
I tried resetting the launch services database on the 10.14 system:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
After that all source files including .4dm showed as plain text with no syntax coloring.
Next I installed TM 2.0.15 in Applications (I had 2.0.6 in /Applications/Tools). Suddenly syntax coloring was working for all file types including .4dm. But all the previews were in dark mode which I had not seen before. I could live with that. But then I rebooted and was back exactly where I started. No preview for .4dm and the other source previews worked (but not in dark mode).
Thanks again for all your help on this.
John DeSoi, Ph.D.
On May 15, 2020, at 10:12 PM, Allan Odgaard mailinglist@textmate.org wrote:
The stuff in the bundles does not affect Finder’s (or the system’s) treatment of files. For that, it must be in TextMate’s Info.plist.
But as 4D already have the correct definitions, this should not be necessary.
I'm happy to report I finally solved this issue on 10.14 by removing a bunch of older 4D versions. I had already reviewed the Info.plist files for conflicts and did not find any. But I had another computer with same macOS version and TextMate QL worked as expected. The only difference was a few much older versions of 4D.
That's the good news. Bad news is still no success getting it to work on 10.15. As reported by some others in another thread, everything that is public.source-code just shows as plain text. I noticed the "Extensions" panel in System Preferences has a section for Quick Look. Mine only shows Mail and Reminders. I don't see a way to add an application there.
John DeSoi, Ph.D.