-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
Add ability to copy formatted code to clipboard #3518
Comments
👍 |
We definitely need this. I'd like to copy / paste formatted code into PowerPoint presentations. |
Thumbs up!.. Would be awesome if the code can be copy pasted along with the syntax highlighting into word or ppt!.. Such a good IDE, especially with typescript + angular 2 combo , this wud be like gold for me!...Please provide syntax highlighting.. |
Would love this feature! We regularly share code, and it would be much easier to read/understand if there's color coding and indentation. |
👍 |
You should be able to write an extension to do this, you would need to include a syntax highlighter in the extension though. I'm not sure we would want to integrate something like this into the core editor (concerned about feature bloat). |
I would really like this feature. I was quite surprised that this wasn't already supported when I tried it (I'm a Visual Studio user!). If an extension had to do its own syntax highlighting I think that wouldn't be a great user experience, as I find how VSCode highlights absolutely fine and wouldn't want to have to manage a separate highlighter configuration. Are you concerned about feature bloat from an end-user perspective or from the codebase itself? I wouldn't comment on the latter, but from an end-user perspective, I enjoy the fact that it's seamless on VS. i.e. VS copied the colour information and if I tried to paste in to an app that didn't support colour (e.g. notepad) then it just disappeared and the app behaved as if I was pasting plain text. In apps like PowerPoint (where I regularly copy and paste code snippets!) I have the source formatting and plain text options available. |
+1 |
3 similar comments
👍 |
👍 |
👍 |
Is there anything that is blocking this, or is it not a desired feature ? |
Dear GitHub Gods, Please add this feature. Sincerely, |
Would love to see this happen. Great for communicating about code. |
there is a plugin for atom: https://atom.io/packages/copy-as-rtf and Code highlighting for Keynote presentations maybe someone can write a plugin to wrap these |
HI, I had just publish a plugin for this: |
Hey, thanks, Atian! We'll check it out! |
Hello @atian25, Thanks for the extension but it copies the text and put "literal" RTF signatures/tags (whatever people call them) around it. So when I paste the code, I get something like this:
... when I am expecting a color coded text similar to below: @unittest.skipIf(mock is None, ...) If it helps, I'm pasting it into an blank Outlook email window. For those who want an interim solution, look at Notepad++'s NppExport plugin (Copy HTML to clipboard) |
hey, @johncruise the gif is truncated, can't see what menu is selected. the extension is use so, for now, you can:
but, I don't know whether I don't have window and outlook now, could you please have a try and feed back? btw, you can report an issue/suggest at https://github.com/atian25/vscode-copy-syntax/issues |
@Tyriar does vscode have any api for extension to set clipboard? |
@atian25 there is no copy and paste in the API, I think the advice is to pull in a node module which does it for you. |
@Tyriar This capability should be part of native VS Code experience, not as a plugin. How many 👍 do you need before getting convinced to implement it as part of VS code? |
@harikrishkk Just simply Ctrl/Cmd+C without any configuration. @thomas-taylor @schallm or anyone uses Dark theme, I'm a Dark theme guy as well. At the very beginning, I didn't put the background color from the theme into the output content, but later on I found for most cases the output is ugly or unreadable. I suppose you can imagine that as for Dark theme, the font color are always light. Light font above white background is terrible most of the time. The dark theme you are using makes sure that the background color and foreground color has good contrast so I choose to ship bkg color to the clipboard. I can see reasons that why customizing the pasted content style is useful as sometimes you can't easily modify the styles in the target application. Look forward to more users feedback on this once we ship it to stable. |
@harikrishkk - You say you have latest, but just to be sure you know, today this is only in the insider build: https://code.visualstudio.com/insiders @rebornix - I think the way it matches the theme exactly (including background) is perfect. Regular VS 2015 appears to switch the entire theme (for example text that is white in VS 2015 dark theme is pasted as black text in Word/Outlook). This works fine too (for my needs), but I like your implementation in VS Code better. That said, I also like the suggestion from @schallm to have a setting to choose the theme that you want to use for this cut/paste feature. |
Superb! I just installed the one with the insiders link! .what i previously
downloaded was the normal one from the vs code site... And i tried copy
pasting a sample to word doc! sweet!... A simple crtl+ c, and paste it!....
@thomas taylor, thanks a lot!...
[image: Inline image 1]
…On Sat, Feb 18, 2017 at 1:24 AM, Thomas Taylor ***@***.***> wrote:
@harikrishkk <https://github.com/harikrishkk> - You say you have latest,
but just to be sure you know, today this is only in the insider build:
https://code.visualstudio.com/insiders
@rebornix <https://github.com/rebornix> - I think the way it matches the
theme exactly (including background) is perfect. Regular VS 2015 appears to
switch the entire theme (for example text that is white in VS 2015 dark
theme is pasted as black text in Word/Outlook). This works fine too (for my
needs), but I like your implementation in VS Code better. That said, I also
like the suggestion from @schallm <https://github.com/schallm> to have a
setting to choose the theme that you want to use for this cut/paste feature.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3518 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEyqyJZ3Hcy35ak_0ysS4HCMfSG-YqPPks5rdfr6gaJpZM4HkOob>
.
|
When I try to copy using right click | Copy Syntax, I get the error "Command failed: python -V". Do I need to pre-install anything? |
@munish, https://code.visualstudio.com/insiders try downloading the
installer from here and see if its working..i had the same issue when i was
just trying to take the latest of the VS code from the usual site. After
installing this build ( a green one ), it did work for me
…On Sun, Feb 19, 2017 at 2:41 PM, Munish Arora ***@***.***> wrote:
When I try to copy using right click | Copy Syntax, I get the error
"Command failed: python -V". Do I need to pre-install anything?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3518 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEyqyF0YSxaBQIl30R7qz1lEK1p7yKzoks5reAdYgaJpZM4HkOob>
.
|
Thanks Harikrishnan .. it worked.. |
Not working with Powerpoint. I have to copy it in Word first then I have copy from word and paste in Powerpoint |
@MateenKadwaikar is there anyway in Powerpoint that can trigger a force copy with formatting? In Outlook on macOS, I have to do that always as the default paste is just pasting plain text. |
@MateenKadwaikar , +1 to @rebornix. PowerPoint has a default text based paste. From Edit menu though you can choose "Paste Special...", which will give HTML and RTF options. I have found the VS Code HTML copy to work with both. |
Is anyone facing issues while copy pasting? I get the code but indentations
is all wrong and has to put tab or space every single time. A couple of
updates before, it wasnt the case i guess.
…On Wed, Feb 22, 2017 at 3:11 AM, Meligy, GuruStop.NET < ***@***.***> wrote:
@MateenKadwaikar <https://github.com/MateenKadwaikar> , +1 to @rebornix
<https://github.com/rebornix>. PowerPoint has a default text based paste.
From Edit menu though you can choose "Paste Special...", which will give
HTML and RTF options. I have found the VS Code HTML copy to work with both.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3518 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEyqyGFDg0LecvhvR61GG82TRpPG2JVhks5re1oWgaJpZM4HkOob>
.
|
+1 It doesn't work with OneNote 2016 either |
@dalyIsaac do you mind sharing what platform and version you are using and a gif can help me understand what's going on, thanks! |
@rebornix Is this feature configurable? I couldn't find a setting for disabling this feature.. Unlike other people in this thread I personally prefer copying the plain text and nothing else. I also think copying plain text should be the DEFAULT behavior, like all other similar, non-IDE text editors (e.g. Atom, Sublime Text, Notepad++). I appreciate all the effort went into enabling this feature. I hope you guys can add a boolean option in Settings file to enable/disable it. |
@tedyun If you want to copy plain text: select text the Edit --> Copy |
@lukeaus It doesn't work that way in my machine. Both (Edit -> Copy) and (Ctrl+C) copy the text WITH syntax highlighting. Version 1.12.2, Windows 10. |
@rebornix I'd really appreciate if you can take a second look at this issue. |
@tedyun we put both plain text and html in clipboard and it's the target application who decides which format to paste. |
@rebornix when copying codes into OneNote2016, indentation(using spaces) will get lost. It seems that OneNote will ignore |
I'd like to using
How to realize it in VScode ? |
@rebornix @Meligy on Outlook for Mac (v15.35) I can get formatted text into an email if I spam the crap out of paste cmd (below) I can detect visually a FOUC-like render of the formatted paste under normal conditions too (one can see in the screen cast too). Surely there must be a way to disable the sanitizing that Outlook is doing in Outlook prefs, rt? (If anyone knows, plz share) Definitely not a problem with VSCode... i just really want to be able to paste syntax-highlighted snippets in company email 😞 |
@eckdanny You don't need to spam the paste key combo. Just paste once, and then notice the little icon that appears after your paste. Click the icon and change it to "keep source formatting." |
@aptend you can paste into Word, copy, and paste into OneNote. If you remove the dark text background color the text colors are too light to see, but you can change VS Code to a light theme before copying ;) I also found a few OneNote requests in UserVoice that everybody should upvote: |
It doesn't work with OneNote 2016! |
I'd like to request adding the ability to copy selected code to the clipboard with syntax highlighting. This is useful for pasting formatted code into another application (e.g., Word document, e-mail).
Regular Visual Studio does this by default (it puts both text and RTF formats on the clipboard).
RTF works well for me, but maybe HTML would be okay too, as long as it is 'pastable' (dependency-free).
The text was updated successfully, but these errors were encountered: