mushanshitiancai / vscode-paste-image

paste image from clipboard to markdown/asciidoc directly!
MIT License
425 stars 129 forks source link

Added Windows support through a Powershell script #2

Closed kivle closed 7 years ago

kivle commented 7 years ago

Hi,

I have added basic Windows support to your extension through a Powershell script. There might be technical issues that I have not thought about, but this seems to work very well on my machine.

Hope you consider merging it into your next version. :)

Best regards, Helge Elvik

mushanshitiancai commented 7 years ago

Amazing!Thank you for your efforts!I tested in my windows virtual machine, it work for me.And I public a new version plugin, everyone can use it now😀

But I found a problem,that powershell process will call on data method twice, I guess they correspond stdout and stderr. The second call will pass a empty string, so I add a check in saveClipboardImageToFileAndGetPath.

And I have a question about the speed of powershell script. It cost almost 2~3s to paste a image or prompts no a image in clipboard. It's because of the powershell context startup cost?

kivle commented 7 years ago

Hi. :) 2-3 seconds sounds like a lot. It takes maybe 0,5-1 seconds on my machine, but I guess that depends on Powershell version and a lot of other factors. Starting Powershell can be a bit slow since it has to load the whole .NET Framework. It could be an alternative to create a small command line application instead maybe.

Anyways, thanks for taking the pull request. Many of my colleagues at work really wanted this extension since we are using Markdown for our technical documentation. Your extension will be a lot of help to us.

mushanshitiancai commented 7 years ago

I get it. I'm glad that this extension can help you. Thank you for you pull request😀

mushanshitiancai commented 7 years ago

I add a featrue that can use selected text as the image file name.Hope to help you.And I add suppot to Linux.

paste-image