Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy-Paste Broken #13366

Closed
swashcap opened this issue Oct 7, 2016 · 56 comments
Closed

Copy-Paste Broken #13366

swashcap opened this issue Oct 7, 2016 · 56 comments
Assignees
Labels
macos Issues with VS Code on MAC/OS X upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Milestone

Comments

@swashcap
Copy link

swashcap commented Oct 7, 2016

  • 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
@sirhodes
Copy link

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

VSCode Version: 1.5.3
OS X Version: 10.12

@sebnor
Copy link

sebnor commented Oct 16, 2016

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?

@pablolmiranda
Copy link

Same issue for
VSCode Version: 1.6.1
OSX Version 10.12

@pablolmiranda
Copy link

pablolmiranda commented Oct 20, 2016

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

@swashcap
Copy link
Author

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

@rpassis
Copy link

rpassis commented Oct 23, 2016

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

@alexdima
Copy link
Member

@bpasero @joaomoreno Can you please also try this?

@alexdima alexdima added the macos Issues with VS Code on MAC/OS X label Oct 26, 2016
@joaomoreno
Copy link
Member

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

@rpassis
Copy link

rpassis commented Oct 27, 2016

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 (notifications@github.com)
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
#13366 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAXoB7M5NgqszeS8hy3skM4Hsy5i405zks5q4E5vgaJpZM4KRU0w
.

@alexdima alexdima added the info-needed Issue requires more information from poster label Oct 27, 2016
@alexdima
Copy link
Member

@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 ?

@rpassis
Copy link

rpassis commented Oct 27, 2016

Only the editor is affected.

Sent from my iPhone

On 28 Oct. 2016, at 3:44 am, Alexandru Dima notifications@github.com 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.

@alexdima
Copy link
Member

alexdima commented Oct 27, 2016

@rpassis

To validate if this is electron/electron#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.

@rpassis
Copy link

rpassis commented Oct 27, 2016

@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!

@imeredith
Copy link

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.

@alexdima
Copy link
Member

@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...

@alexdima alexdima added the help wanted Issues identified as good community contribution opportunities label Oct 31, 2016
@bpasero bpasero added this to the Backlog milestone Oct 31, 2016
@bpasero
Copy link
Member

bpasero commented Oct 31, 2016

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

@bpasero bpasero removed their assignment Oct 31, 2016
@joaomoreno
Copy link
Member

@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

@rpassis
Copy link

rpassis commented Nov 1, 2016

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,

@rpassis
Copy link

rpassis commented Nov 1, 2016

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

@joaomoreno
Copy link
Member

joaomoreno commented Nov 1, 2016

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.

@withoutclass
Copy link

withoutclass commented Apr 20, 2017

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.

@NorthBei
Copy link

NorthBei commented May 9, 2017

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

@tepamid
Copy link

tepamid commented May 15, 2017

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

@narzero
Copy link

narzero commented May 19, 2017

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)

@Knovour
Copy link

Knovour commented May 28, 2017

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.

@alexdima alexdima modified the milestones: Backlog, May 2017 May 31, 2017
@payneio
Copy link

payneio commented Jun 1, 2017

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.

@wli3
Copy link

wli3 commented Jun 19, 2017

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

  • VSCode Version: Code 1.13.1 (379d2ef, 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

@yashafromrussia
Copy link

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?

@yashafromrussia
Copy link

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

@bplus
Copy link

bplus commented Jul 3, 2017

@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!

@Ilya-Valasiuk
Copy link

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

@akurkin
Copy link

akurkin commented Aug 20, 2017

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.

@aaron770
Copy link

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

@fzxt
Copy link

fzxt commented Aug 30, 2017

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

@Kharms
Copy link

Kharms commented Sep 8, 2017

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

@andreportaro
Copy link

Always happens to me when starting code from terminal. 😢

@mpeschke
Copy link

mpeschke commented Sep 28, 2017

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.

@mlynch
Copy link

mlynch commented Oct 5, 2017

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.

@christopher-francisco
Copy link

christopher-francisco commented Oct 13, 2017

Confirming this is a thing, launching from within a:

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

@iosdev-republicofapps
Copy link

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! :-)

@dkent600
Copy link

dkent600 commented Oct 20, 2017

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...

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
macos Issues with VS Code on MAC/OS X upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests