mushanshitiancai / vscode-paste-image

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

Specify file name when pasting #33

Closed DonMartin76 closed 5 years ago

DonMartin76 commented 5 years ago

Thanks for a really great extension!

What I would love to have is an option to change the file name of the image file when pasting. The option to specify the path of the image is already really good, but the cherry on top would be a configurable behavior which lets you specify a custom file name, right after hitting Meta-Alt-V.

Like this:

  1. Make a screen shot and store it in the clipboard
  2. In VS Code, hit Meta-Alt-V
  3. VS Code asks you for a filename (by some means; a dialog, popup, whatever)
  4. The image is created with the given file name, and the markdown tag is created

The feature should be configurable so that you can still keep the previous behavior (e.g. time stamp). Also it would be nice if it could use the filename setting as a default file name, so that you can just hit "Enter" in case you do not need a custom file name.

I admit I have no clue whether this is easy or difficult to implement in VS Code, but I would really love to have this functionality in.

DonMartin76 commented 5 years ago

Found this, and it seems to be fairly simple actually: https://code.visualstudio.com/docs/extensionAPI/vscode-api#window.showInputBox

DonMartin76 commented 5 years ago

Created a PR, have a look if you want.

mushanshitiancai commented 5 years ago

Thank you very much!!

Now you can select text as the image file name (show in the gif on homepage), is it meet you requirement?

tsugliani commented 5 years ago

I'm very interested into this feature too :-)

This + the folder preset would be a perfect match for my needs.

mushanshitiancai commented 5 years ago

@DonMartin76 @tsugliani

I think it's really a good feature finally, so I merged this PR. And I and a configuration to control the inputbox show full path or only name.

I publish a new version(1.0.3), You can try it.