Closed marcinjahn closed 2 years ago
Mea culpa. I have accidentally removed support for it in #54 by removing this codepath.
It will be fixed soon.
@marcinjahn
You can test the fix by running
git clone https://github.com/knyzorg/vscode-markdown-paste-image
cd vscode-markdown-paste-image
npm i
npx vsce package
code --install-extension ./vscode-markdown-paste-image-0.15.2.vsix
@knyzorg The error is a bit different now:
12-26 20:03:01] "vscode-markdown-paste" is now active!
[12-26 20:03:01] No scipt exists for darwin
[12-26 20:03:01] Clipboard Type:
[12-26 20:03:01] -1
[12-26 20:03:04] /Users/marcin/.vscode/extensions/telesoho.vscode-markdown-paste-image-0.15.2/res/mac.applescript: /Users/marcin/.vscode/extensions/telesoho.vscode-markdown-paste-image-0.15.2/res/mac.applescript: cannot execute binary file
What happens when you try running osascript /Users/marcin/.vscode/extensions/telesoho.vscode-markdown-paste-image-0.15.2/res/mac.applescript
? Do you encounter the same error?
~/.vscode/extensions/telesoho.vscode-markdown-paste-image-0.15.2/res
❯ osascript /Users/marcin/.vscode/extensions/telesoho.vscode-markdown-paste-image-0.15.2/res/mac.applescript
~/.vscode/extensions/telesoho.vscode-markdown-paste-image-0.15.2/res
It executes properly (I passed no arguments like in your example).
@telesoho Do you have a macbook you can test with? I'm not sure why this is happening. It seems to work from CLI but not from the extension.
@knyzorg I think there is some issue with the choice of executor. I logged the ${shell} ${options.join(" ")}
line of
the runCommand
function. I got sh /Users/marcin/.vscode/extensions/telesoho.vscode-markdown-paste-image-0.15.2/res/mac.applescript /Users/marcin/tmp/2021-12-26-20-20-59.png
. It should use osascript
instead of sh
I guess.
@marcinjahn I did some changes. Can you pull and try again?
@knyzorg Yes, that works. Actually, I started creating a branch with that fix, but you were faster. Also, you fixed more switch cases than that single place.
@knyzorg Even though the functionality works, the log is a bit confusing:
[12-26 20:37:32] "vscode-markdown-paste" is now active!
[12-26 20:37:32] No scipt exists for darwin
[12-26 20:37:32] Clipboard Type:
[12-26 20:37:32] -1
"No script exists"?
The way this extension is designed, it expects to have multiple scripts for each OS.
One for
The only one we have for Mac is pasting images. So the way it works is it fails detect the clipboard type for Mac and falls back to attempting to extract plain text, which if fails, runs the paste image script.
I'm not very good with Macs, so someone will need to write the other scripts.
Yeah, I see that in code. I'm not good neither, today was the first time I saw actual AppleScript code :)
The fix has been merged
Having the same issue on macOS Monterey on version 0.18.6. Copy past image works as expected but download image results in output
[04-01 00:24:05] "vscode-markdown-paste" is now active!
[04-01 00:24:05] No scipt exists for darwin
[04-01 00:24:05] Clipboard Type:
[04-01 00:24:05] -1
Since the last update I cannot paste images into markdown anymore on macOS Monterey. I see the following logs:
A couple days ago it worked perfectly fine.