mushanshitiancai / vscode-paste-image

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

Support remote development mode #44

Open nitingupta910 opened 5 years ago

nitingupta910 commented 5 years ago

VSCode recently added support for Remote Development. When this extension is installed remotely and I take screenshot locally, pasting of image to remote document does not work since the extension cannot access the local clipboard.

Would it be possible to access local clipboard when this extension is installed remotely?

rhiswell commented 4 years ago

I also have this problem when installing the extension to remote side. Here is the potential solution:

https://code.visualstudio.com/api/advanced-topics/remote-extensions#using-the-clipboard

GrayXu commented 4 years ago

same problem, TAT

wdhongtw commented 4 years ago

If my investigation is correct, the extension won't work on Visual Studio Code Remote Development mode. Because currently the extension use wrapper script to manage clipboard image on Remote OS, and the image we want to paste only exists in Local OS.

The potential solution metioned by @rhiswell will not help at this time. The Clipboard API Do sync the clipboard content from Local OS to Remote OS, but the API can only access text content.

There seems a clipboard API which will support arbitrary content type in the future, according to Expose Clipboard#read/write with data transfer · Issue #77790 · microsoft/vscode. Once the new API is ready and do support remote development mode, maybe we can change the implementation of this extension.

Disclaimer: I do not maintain this extension, just someone who also hope this feature come true. :D

RyanPersson commented 3 years ago

[This doesn't seem to work after further experimentation, it doesn't seem to actually save the created image]

I was able to get a fork of this extension, telesoho/vscode-markdown-paste-image, to work with the wsl remote development suite, by forcing the extension to run on the ui/windows side where it has access to the clipboard.

I did this by adding:

    "remote.extensionKind": {
        "telesoho.vscode-markdown-paste-image": ["ui"],
    }

to settings.json.

Using:

    "remote.extensionKind": {
        "mushan.vscode-paste-image": ["ui"],
    }

may fix your issue.

sakamoto66 commented 3 years ago

fix your issue.

https://marketplace.visualstudio.com/items?itemName=sakamoto66.vscode-paste-image

this extention access local clipbord when use Remote Development mode.

RyanPersson commented 3 years ago

@sakamoto66 Works for me in WSL! Thank you!

Note: I had to disable other extensions which also use the Ctrl+Alt+v keybinding, in order for it to work. I thought it wasn't at first.

sakamoto66 commented 3 years ago

@RyanPerson feedback, thank you!

Note: I had to disable other extensions which also use the Ctrl+Alt+v keybinding, in order for it to work. I thought it wasn't at first.

That is the destiny of vscode. You can find the measures here.

  1. Open Command Palet (Ctrl + Shift + P).
  2. Input "Open keyboard Shortcuts" on Command.
  3. Input "Ctrl Alt V" on filter.
  4. Disable keyboard shortcuts other than "Paste image of clipboard".
pduchnovsky commented 3 years ago

fix your issue.

https://marketplace.visualstudio.com/items?itemName=sakamoto66.vscode-paste-image

this extention access local clipbord when use Remote Development mode.

Unfortunately, this seems to be kind of broken, since I cannot use variables like ${currentFileNameWithoutExt} Therefore I cannot put the images in to folders that are created specifically with my current file name without extension by Hexo.

This is my current structure of source directory, I created the test file, then pasted an image it just created directory named ${currentFileNameWithoutExt}

source/ ├─ _posts ├── ${currentFileNameWithoutExt} └── test.md

allamand commented 3 years ago

Still not working here, with the Error There is not an image in clipboard did you manage to paste images in remote vscode ?

EDIflyer commented 1 year ago

I'm using MkDocs-Material and have Paste Image nicely configured when working just on my local machine and pushing to Github, but would love to have it working when in VS Code remote development mode - I had the same issue as @pduchnovsky when it came to filenames though, has anyone found a good workaround?