Vscode: Copy-Paste Broken

Created on 7 Oct 2016  ·  56Comments  ·  Source: microsoft/vscode

  • VSCode Version: 1.5.3
  • OS Version: OS X 10.12

Steps to Reproduce:

  1. Open a (JavaScript) file
  2. Try to copy and paste (using either Command + C or the _Edit_ menu)
  3. Observe the system clipboard (and VS Code’s clipboard?) don’t copy selected text
editor mac upstream

Most helpful comment

An interesting thing, it is only broken when I open using the command line. I created a symlink

/usr/local/bin/vscode -> /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code.

When I use the symlink to open a folder or a file, the copy/paste doesn't work.

VSCode Version: 1.6.1
OSX Version 10.12

All 56 comments

also having this issue, same reproduce steps, same details:

VSCode Version: 1.5.3
OS X Version: 10.12

Same issue on windows. Does not happen all the time though, and pressing ctrl +c multiple times will eventually copy the text. (I have confirmed the issue with a second keyboard, since I first thought it was my keyboard that started giving up. Also, the issue is isolated to VS Code - copy paste works correctly outside the application)

VSCode Version: 1.6.1
Windows 10

Edit: The cause of my copy-paste issue was an extension called "SirTobi.code-clip-ring", after uninstalling it I have not had any issues with copy-paste. Being the only one with windows in this thread having the issue, maybe concludes that it's something related to OS X + VS Code?

Same issue for
VSCode Version: 1.6.1
OSX Version 10.12

An interesting thing, it is only broken when I open using the command line. I created a symlink

/usr/local/bin/vscode -> /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code.

When I use the symlink to open a folder or a file, the copy/paste doesn't work.

VSCode Version: 1.6.1
OSX Version 10.12

This might be related to electron/electron#7663. I noticed the same issue with our custom Electron app, which is running on [email protected] at the moment.

I can reproduce the exact issue as described by @pablolmiranda.

Copy and paste doesn't work when opening VSCode via command line.

/usr/local/bin/code -> /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code

VSCode 1.6.1
macOS 10.12

@bpasero @joaomoreno Can you please also try this?

Works fine for me. Does it reproduce when running with --disable-extensions?

I can consistently reproduce the problem by

1) Completely shutting down VS Code
2) Opening it via terminal with code —disable-extensions
3) Trying to copy & paste any text

Interestingly, if VS Code is already open/running, I can repeat the steps
above starting from #2, and copy & paste works as expected.

On 27 October 2016 at 6:10:41 pm, João Moreno ([email protected])
wrote:

Works fine for me. Does it reproduce when running with --disable-extensions?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/13366#issuecomment-256564121,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAXoB7M5NgqszeS8hy3skM4Hsy5i405zks5q4E5vgaJpZM4KRU0w
.

@rpassis Does it work to copy/paste out of a native filed such as the find input or is copy/paste flaky only for the editor ?

Only the editor is affected.

Sent from my iPhone

On 28 Oct. 2016, at 3:44 am, Alexandru Dima [email protected] wrote:

@rpassis Does it work to copy/paste out of a native filed such as the find input or is copy/paste flaky only for the editor ?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@rpassis

To validate if this is https://github.com/electron/electron/issues/7663 can you please try the following trick:

Bind two more keybindings to copy (only temporarily)

Here I am on Windows, but you get the drill -- cmd+c, cmd+f, cmd+d (Preferences > Keyboard Shortcuts)

[
{ "key": "ctrl+c", "command": "editor.action.clipboardCopyAction", "when": "editorTextFocus" },
{ "key": "ctrl+f", "command": "editor.action.clipboardCopyAction", "when": "editorTextFocus" },
{ "key": "ctrl+d", "command": "editor.action.clipboardCopyAction", "when": "editorTextFocus" }
]

Try to copy with any of the keybindings.

@alexandrudima

Unfortunately I get the same behaviour with custom keybindings.

I've made a quick screencast to demonstrate the problem in case it helps

https://www.youtube.com/watch?v=r-eHgjZHQk8

Thanks for following up!

I just ran into this issue. I had closed vscode completely then opened it via console. After reading this, I closed it again, and opened via spotlight, and then opened my project from the console again, and it works again.

@rpassis Thank you for the screencast.

I'm sorry I'm honestly stumped by this and cannot find a reasonable explanation why this would be happening. It also doesn't help that I'm not a mac user. I know on the mac you can close all windows of an app and the app still runs in a window-less fashion. Is it that you entirely kill the app between the two tests (I only see the apple logo flashing, indicating that a keybinding in there got triggered).

On my side, I have the exact same code to deal with copying or pasting, regardless how VSCode is launched and regardless of OS. (In fact the same code runs in any browser at https://microsoft.github.io/monaco-editor/)

I can only bring in the mac experts on our team and hope they know something about it, but I don't think this is an issue in our code...

I never saw this and I do copy/paste ALL the time...

@rpassis Can you show me your .bashrc or .zshrc? Also, does it work if you launch it from a clean shell?

env -i bash
code testfile

Thanks Joao.

A clean shell didn’t solve the problem but it made me look into a couple of
different scenarios and what seems to be consistently happening is that
copy & paste is only broken when starting VS Code from inside a tmux
session.

Perhaps @imeredith and @pablolmiranda could confirm whether they use tmux
as well?

Thanks all,

In addition to the above, I also noticed that two instances of VS Code are running in parallel when I start one via my tmux session and another via a separate clean shell session

>> ps -A | grep "Visual Studio Code"
98916 ??         0:02.16 /Applications/Visual Studio Code.app/Contents/MacOS/Electron
98927 ??         0:01.20 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=gpu-process --channel=98916.0.1792864745 --mojo-application-channel-token=E0684152524C5630FD42FAC44CCD16C9 --no-sandbox --supports-dual-gpus=true --gpu-driver-bug-workarounds=16,36,50,51,55,57,65,66,72,75 --gpu-vendor-id=0x1002 --gpu-device-id=0x6810 --gpu-driver-vendor --gpu-driver-version --gpu-driver-date --gpu-secondary-vendor-ids=0x8086 --gpu-secondary-device-ids=0x0412 --gpu-active-vendor-id=0x1002 --gpu-active-device-id=0x6810
98929 ??         0:00.52 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap --type=SharedProcess
98930 ??         0:03.25 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=renderer --no-sandbox --primordial-pipe-token=C889A8359FB0016E9433A9E71A723936 --lang=en-GB --node-integration=true --background-color=#171717 --enable-pinch --num-raster-threads=2 --enable-zero-copy --disable-partial-raster --enable-gpu-memory-buffer-compositor-resources --content-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --video-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --mojo-channel-token=8A9F7354CF99A9F30EB8A2A173215F79 --mojo-application-channel-token=62A0EF870EA033AFA45B709BB2316499 --channel=98916.1.203873832
98931 ??         0:00.30 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap --type=extensionHost
98933 ??         0:00.01 /Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Resources/crashpad_handler --database=/tmp/VSCode Crashes --url=https://ticinocrashreporter.azurewebsites.net/crash --handshake-fd=58
98945 ??         0:02.68 /Applications/Visual Studio Code.app/Contents/MacOS/Electron
98946 ??         0:01.14 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=gpu-process --channel=98945.0.1504175786 --mojo-application-channel-token=8D681B432D047EE588EEB26E11011985 --no-sandbox --supports-dual-gpus=true --gpu-driver-bug-workarounds=16,36,50,51,55,57,65,66,72,75 --gpu-vendor-id=0x1002 --gpu-device-id=0x6810 --gpu-driver-vendor --gpu-driver-version --gpu-driver-date --gpu-secondary-vendor-ids=0x8086 --gpu-secondary-device-ids=0x0412 --gpu-active-vendor-id=0x1002 --gpu-active-device-id=0x6810
98947 ??         0:00.51 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap --type=SharedProcess
98948 ??         0:05.08 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=renderer --no-sandbox --primordial-pipe-token=B4C27F4CB3E3BAFE72527ACB02A08300 --lang=en-GB --node-integration=true --background-color=#171717 --enable-pinch --num-raster-threads=2 --enable-zero-copy --disable-partial-raster --enable-gpu-memory-buffer-compositor-resources --content-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --video-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --mojo-channel-token=EA712FC7B3A98BDBE66C64B169366BDE --mojo-application-channel-token=98363464E27C89721F6DECFD28D041BD --channel=98945.1.47309761
98949 ??         0:00.32 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap --type=extensionHost
98951 ??         0:00.01 /Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Resources/crashpad_handler --database=/tmp/VSCode Crashes --url=https://ticinocrashreporter.azurewebsites.net/crash --handshake-fd=58
98956 ??         0:04.37 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=renderer --no-sandbox --primordial-pipe-token=760CE3EC74E6971DDABA5C2D32ED6BF7 --lang=en-GB --node-integration=true --background-color=#171717 --enable-pinch --num-raster-threads=2 --enable-zero-copy --disable-partial-raster --enable-gpu-memory-buffer-compositor-resources --content-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --video-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --mojo-channel-token=F6A3DD7E21437DD1CB140E7011618E02 --mojo-application-channel-token=E01632E88BA417A744A7D89FA8408869 --channel=98916.2.211442047
98957 ??         0:00.30 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap --type=extensionHost
98968 ??         0:02.88 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=renderer --no-sandbox --primordial-pipe-token=DB751253075B3A61AC86615B03AAEFF9 --lang=en-GB --node-integration=true --background-color=#171717 --enable-pinch --num-raster-threads=2 --enable-zero-copy --disable-partial-raster --enable-gpu-memory-buffer-compositor-resources --content-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --video-image-texture-target=3553,3553,3553,3553,3553,34037,3553,3553,3553,3553,3553,34037,3553,34037,34037 --mojo-channel-token=6940FA876FC42D01B2E346BDAB01C35A --mojo-application-channel-token=459C432636C3DA9B0809BDC3A1C6E7CB --channel=98945.2.1915742210
98971 ??         0:00.29 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap --type=extensionHost
99021 ttys011    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn Visual Studio Code

You can also see that on the Mac Dock (see two VS Code icons on the right hand side of the image below).

screen shot 2016-11-01 at 11 54 57 am

Good, we're getting somewhere. 👍

I still can't reproduce when using tmux, though. What's the output of echo $TMPDIR inside and outside of a tmux session? Also of echo $XDG_CONFIG_HOME.

Hi @joaomoreno

I just found this issue under the Electron repo which explains the behaviour some of us are experiencing.

https://github.com/electron/electron/issues/916

Since it's not VS Code related, I think it is safe to close it.

Thanks again

Epic find. Thanks a lot!

If you're experiencing this on macOS and are using tmux or screen as I am, check out https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard#mac-os-x-pasteboard-access-under-tmux-and-screen :heart:

here's a repro using tmux on os10.12

vscode-13366

I just updated from os 10.10 yesterday and noticed this today. Hoping the link from @timrogers helps me sort this out.

_UDPATE_: I may have obfuscated the issue in my licecap. *Any _paste_ doesn't work... not just pbcopy/pbpaste stuff. Results from using mouse actions is the same.

I do not know if this is the exact same problem, but I was using VSCode Insiders for several months on OSX 10.10.2 and could easily Copy & Paste Text from an open file in the Editor window to the Integrated Terminal.

After updating to the latest version of VSCode Insiders 1.9.0 today:

  • If I Copy & Paste from the Editor into the Integrated Terminal, nothing appears to be pasted!
  • Press Enter -> the next line shows the text that was pasted before

I am not using any special tmux session. This is just the standard Terminal that comes with VSCode Insiders.

@maxruby Perhaps you can create a separate issue

@eckdanny
i have the same problem! if i run vscode with code . in tmux, copy and paste doesn't work.
now i found why! Thank you so much

I still have this issue as well, when I use tmux the copy paste is broken. Is there a workaround for this? Any fix planned?

The workaround is to open VSCode outside of your tmux session.

On 17 February 2017 at 06:54, Steve Azzopardi notifications@github.com
wrote:

I still have this issue as well, when I use tmux the copy paste is broken.
Is there a workaround for this? Any fix planned?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/13366#issuecomment-280440088,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAXoB_X6VkrseKDm8HCGHoAUZQs2fZOlks5rdKl8gaJpZM4KRU0w
.

The issue is, I have tmux auto starting from my .bashrc like the below which also means that it auto starts inside of the built in console of vs code. Should this be a separate issue.

if [ "$TMUX" = "" ]; then tmux; fi

No the issue is the same.

Just dettach from your tmux session and start VScode then reattach. Or just
open the app via finder instead of using the command line.

On Fri, 17 Feb 2017 at 7:13 am, Steve Azzopardi notifications@github.com
wrote:

The issue is, I have tmux auto starting from my .bashrc like the below
which also breaks the copy/paste. Should this be opened as a separate issue?

if [ "$TMUX" = "" ]; then tmux; fi


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/13366#issuecomment-280445527,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAXoB_SkRnhO07xg8PfEQmcgVOzq3Q3rks5rdK38gaJpZM4KRU0w
.

@rpassis Sorry updated the description to be more clear.

Any fix? Cant use it like this.

Same issue for
VSCode Version: 1.10.2
OSX Version 10.12
and i opening VSCode from Lanchpad , not command line.
when i stop my Vim(0.6.11) pluging, it's working.

same...
copying from Safari: Version 10.1 (12603.1.30.0.34)
macOS: 10.12.4
Code: Version 1.11.2 (1.11.2)

This bug is back. In the previous release the bug was fixed, but since upgrading to version 1.11.2 it has re-surfaced. If I re-launch VS Code a few times sometimes it will start working again though.

macOS: 10.12.4

Note that I use US DVORAK keyboard layout.

use cmd+c to copy / cmd+v to paste is the same with top

I can't copy/paste anything in terminal area or file manager area

even using cmd+f to search has the same problem

macOS:10.12.4
vscode version 1.12

For me cmd+c and cmd+v don't work only in the Search field of the Search left-side panel.

vscode 1.11.2
MacOS 10.11.6

Copy paste is broken when opening from command line inside tmux session & launchpad.

macOS Sierra 10.12.4
vscode 1.12.2

(when opening from command line outside tmux session it does work)

macOS Sierra 10.12.5
VSCode Insider 1.13.0

  1. Cannot copy paste on search field, but work normally when restart editor with English Input Method. (Not sure how long will keep it work normally)
  2. Integrated terminal use ctrl + v to paste not cmd + v. (Not sure it's a feature or not)
  3. Cannot use cmd + / toggle comment when using Chinese Input Method.

It was working for me to open outside of tmux. Now, the problem happens anytime I open from the console/shell. 1.12.2 on macOS. The only workaround is to open from Applications folder / launcher but then my env paths are not respected and autocomplete/jump doesn't work.

Same as @payneio . And thank you for the walk around

  • VSCode Version: Code 1.13.1 (379d2efb5539b09112c793d3d9a413017d736f89, 2017-06-14T18:13:05.928Z)
  • OS Version: Darwin x64 16.6.0
  • Extensions:

|Extension|Author|Version|
|---|---|---|
|xml|DotJoshJohnson|1.9.0|
|Ionide-fsharp|Ionide|2.27.4|
|vscode-docker|PeterJausovec|0.0.16|
|shell|bbenoist|0.3.0|
|whitespace-plus|davidhouchin|0.0.4|
|csharp|ms-vscode|1.10.0|
|PowerShell|ms-vscode|1.3.2|
|qub-msbuild|qub|0.6.3|
|code-spell-checker|streetsidesoftware|1.2.0|;

For those who run code . in a tmux session and copy/paste doesn't work, does entering full screen in VSCode work when you open it through a tmux session?

Seems to be fixed after installing reattach-to-user-namespace with brew. and enabling it in ~/.tmux.conf

```
set-option -g default-command "reattach-to-user-namespace -l zsh"
````

https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard#quick-summary

@gorjuspixels's comments / Chris Johnsen's pasteboard code above fixed this issue for me (specifically, copy and paste not working, and being unable to maximize, when starting visual studio code from the command prompt with 'code .').

Thank you!

On 1.14.1 version Copy/Paste is broken.
Anyone reproduce this?

Copy/paste works when launching VS Code from tmux session with plugin tmux-yank installed and reattach-to-user-namespace binary installed and configured as part of tmux-yank.
macOS Sierra 10.12.6
VS Code 1.15.1

I have exact same setup on another system, BUT without tmux-yank/reattach-to-user-namespace and copy/paste in VS Code when launching from tmux terminal is still broken.

Had the same problem just left clicked and copy and left click past worked for me.

This still occasionally happens to me. Solution has always been restarting it.

Why is this closed? I tried to copying from vscode the bash terminal is broken when over a certain length.

Always happens to me when starting code from terminal. 😢

Still broken. Version 1.16.1, using RHEL 7.4.

Update: this problem looked a lot like trying to copy/paste using CTRL+C / CTRL+V in a VIM editor (obviously won't work). Then I remembered I had the VIM Emulator extension installed... bingo. Uninstalling this extensions solved my problem.

Can confirm this issue is still happening on 1.16.1. Seems to break whether I launch it from a tmux session or from a plain terminal session on OS X.

Confirming this is a thing, launching from within a:

iTerm2 -> tmux -> vim (run :!code %).

I also see this as being broken when I launch VSCode from within a tmux bash session via code .. Any ideas? It works fine if I launch from spotlight, alfred, etc.

Any ideas or ETA for a fix? Thanks! :-)

Has happened to me several times. Pressing Ctrl-C causes ^C to appear at the command prompt.

BTW, I found that after leaving Code and going to another application, then coming back to Code, copy started working again.

I'll see if I can find a consistent repro.

The bug is annoying when the text I need to copy is hard to reproduce...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trstringer picture trstringer  ·  3Comments

lukehoban picture lukehoban  ·  3Comments

sirius1024 picture sirius1024  ·  3Comments

philipgiuliani picture philipgiuliani  ·  3Comments

DovydasNavickas picture DovydasNavickas  ·  3Comments