How to debug quicklook plugin on macOS Catalina? - plugins

I have a quicklook plugin which generates Finder thumbnails and QuickLook Previews for my custom file extension for files in my Virtual File System (developed via FUSE).
The problem is that on macOS Catalina, QuickLook Preview doesn't work for files with specified extension.
Usually, I debug this by having GenerateThumbnailForURL.m 'echo' debug text to a file on Desktop OR NSLog or os_log so that content is visible in Console.app.
However, when Console.app displays the log text from my plugin, it is shrouded with <private> items instead of actual content.
Is there a way to circumvent this for Console.app or some other way in which QuickLook plugin can be debugged on macOS Catalina?
I tried this but it doesn't seem to work on macOS Catalina 10.15.3.

You should not use GeneratePreviewForURL for quicklook preview generation on Catalina.
Instead, one should implement the QuickLook Preview Extension target. Launching the target will open the debug session where everything can be debbuged in classical way.
Btw, echo-ing from GenerateThumbnailForURL.m should no longer work on Catalina because the extension doesn't have write permissions.

Yes, you can still debug Quick Look Plugins on macOS Catalina.
I am on 10.15.6 and using the following:
Add NSLog(...) statements to your code.
Build your .qlgenerator file and install it into ~/Library/QuickLook
run qlmanage -r to activate your new plugin
run qlmanage -p someFile to run the preview generation and see the NSLog statemnts of GeneratePreviewForURL in the Terminal.
run qlmanage -t someFile to run the icon generation and see the NSLog staments of GenerateThumbnailForURL in the Terminal.

Related

Not able to open VS Code from Terminal in my MacBook BigSur11.3.1

Good day community. I have installed VS Code in my MacBook Air M1 chip running on BigSur 11.3.1 but whenever I set the code command in PATH (using Command+Shift+P) it only appears to be working for current session and doesn't work if I restart VSCode. I have to set the code command in PATH again. Please help me in configuring code command permanently so that i can open VSCode from any directory whenever I want. Thanks
I think I have got the solution. After installing VSCode in your Mac (which will be in download folder) move VS Studio Code.app file to Application Folder and then again install the code command in PATH from VSCode(using Command+Shift+P) and thats it.

Fastest Way To Open HTML File in Browser using VScode - Current Extensions Failing

I want to be able to quickly open my html files from VScode to Chrome.
I have been using the extension Open in Browser, but not it appears to be failing.
I've tried this extension alternative, but it doesn't work on my rig either.
As a workaround I am currently searching for the file in finder and dragging it to chrome.
Any suggestions to streamline this process or alternative extensions to open html files in browser?
Rig Details: 2014 Macbook Air Running Mojave 10.14.1
Works for a bunch of extensions:
https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-open-in-application
Example of config for Windows:
"openInApplication.applications": {
"html": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
}

Simple FinderSync extension doesn't seem to be running inside Xcode

I'm using the FinderSync extension template.
Info.plist
When I run the extension target there's zero output in the console. The code doesn't seem to run.
running the extension
I've found success in running the main app target from Xcode rather than the Finder Sync target.
If things are set up correctly, running the main app will in turn install the Finder Sync extension.
Make sure that you have enabled the Extension:
System Preferences > Extensions > Checkbox for Your Extension
This does make debugging a bit annoying, as the debugger will not be attached to the Extension. Simple debugging can be accomplished by setting text to the Finder menus, os_log() to the system console, etc.
You may also be able to attach to to the Extension via Debug > Attach to Process.
So the question is really about how to run a Finder extension inside XCode (how to debug it).
Firstly, you need to register your extension in Finder:
pluginkit -a <path you your debugging appex>
Then, you have to wait to attach to the running instance in Xcode: Debug menu, Attach to Process by PID or Name ... and then enter the name of your executable. Now Xcode is waiting for it to start.
Finally, tell Finder to enable your extension (or restart Finder):
pluginkit -e use -I <ID of you appex>

Finder Synch Extension Waiting to Attach in XCode 7.0.1 OSX 10.10

I have written a Finder Synch extension with Swift and add to my project target in XCode 7.0.1. At first run, it works as normal but after several runs, it stall on Extension Waiting to Attach. If I open a Finder window, nothing happened and my class init never called.
Do you face any problem like this? Using Mac OSX 10.10.5 Yosemite with XCode 7.0.1.
This happened to me also, make sure your entitlements and certificates / signing are set correctly. Working with a non signed finder sync extension caused exactly the problems you described.
edit: one more thing, the optional relaunch (alt + right click on finder) also helps attach to the extension after it is launched.

Visual Studio Code on Mac

I installed Visual Studio Code on Mac/OSX (drop app in Applications)
- uninstalled (moved the App to the Trash)
- installed again
Since the second time I installed I didn't get the same start screen as during my first install I suppose somewhere in my file system Visual Studio Code writes something?
I would like to know where (besides in the Application folder) Visual Studio Code writes files?
VSCode uses another folder to store settings, including a flag to indicate if welcome should show or not. The folder is:
Windows: %APPDATA%\Code
Mac: $HOME/Library/Application Support/Code
Linux: $HOME/.config/Code
I've looked on my wife's mac and can't find a trace of these settings, they're not in any standard folder ($HOME, /Libraries/Preferences, /System/Libraries/Preferences nor /Libraries/Containers).
But to open the original start screen, you can use Help -> Show Welcome.
The settings are stored though, if you run "defaults read" you will see a number of settings related to vscode mentioned, including the files you had open last time you closed. Since Visual Studio Code uses the GitHub Atom Shell under the hood, you need to read the settings for atom using
defaults find atom
which will show you some data stored for the app.