Change:
this._register(languageFeaturesService.documentPasteEditProvider.register('*', new DefaultTextProvider())); this._register(languageFeaturesService.documentPasteEditProvider.register('*', new PathProvider())); this._register(languageFeaturesService.documentPasteEditProvider.register('*', new RelativePathProvider(workspaceContextService))); <ins> this._register(languageFeaturesService.documentPasteEditProvider.register('*', new PasteHtmlProvider())); </ins> } }

Discussion:
Using the latest version of VS Code I don't get the copy with syntax highlighting working as I would expect. When I copy code in one VS Code window (e.g. C# file) and then paste the code into another VS Code window where I am editing a markdown file then the pasted code is plain text and not HTML formatted. Seems like this feature doesn't work at all, because there is no format whatsoever applied when I paste it. According to it should copy it as HTML into the clipboard and given that I am pasting it into a markdown file I would expect that VS Code will paste the HTML formatted code. Looks like that VS Code doesn't respect its own features or maybe it's just fundamentally not working as expected?
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.461 --<!-- potentialduplicatescomment --
VSCode is always text based, say if you copy the content in Chrome, which saves both plain text and html into your clipboard, and then when you paste in VSCode, the plain text will be pasted into VSCode.
Please ask your question on . We have a great community over . They have already answered thousands of questions and are happy to answer yours as well. See also our guidelines. Happy Coding!
I don't quite like it that you close this issue with this explanation. I can see that code is currently always text based, but that is precisely WHY I openen this issue. So saying that code always didn't work as expected is not a reason to justify why it doesn't work as expected, is it? Think from a user's experience: If I purposefully select copy with syntax highlighting in one window of VS Code and then switch to a HTML or Markdown window and say paste, there is NO WAY that any user would NOT want to copy the syntax highlighted text in that instance. So in my opinion the fact that Code doesn't respect its own feature is a bug and really bad user experience IMHO, hence why I think this issue should be re-opened please.
I think there is some big/fundamental misunderstanding here. Please keep in mind the following: files are text files (as opposed to, say a Word file which can save on disk the text + its formatting).

That is, markdown files are stored on disk without any additional metadata, except for the markdown code itself. in a code editor is based on the current text in the text buffer (as opposed to, say Word which never colorizes text unless explicitly directed to do so). That is a code editor uses syntax highlighting and not some additional metadata outside of syntax highlighting. From my understanding of your issue, you are either disagreeing with 1. or 2., but this does not make sense to me. To further explain, consider the following markdown text: <img src="https://user-" width="300" /This gets saved on disk without colorization information: ! You can look at the file on disk, it only contains 61 bytes: ! So only the text of markdown (without colorization information) is stored on disk. The colorization is derived from the textual content at runtime, colorization is not stored in the file. Therefore, it does not make sense for a code editor to ever paste anything else than text.
No there is no misunderstanding, what you say I don't disagree with, but I think you look at things very black and white instead of thinking about the user experience. When I copy a code block from a C# file by explicitly calling the "Copy with syntax highlighting" command, then I definitely want to paste a colourised C# snippet wherever I will try to paste next. Can we agree on that or do you think that doesn't make sense? So if literally the next place I say "paste" is a markdown file, then I'd hope that the syntax highlighted code snippet gets copied there, regardless if it is a text based file, a word document or another C# file, because whatever my reasons are for doing this, I did explicitly ask for it. Make sense? And in the context of a Markdown file this makes a lot of sense anyway, because Markdown can include HTML code, so something like this would make a lot of sense: After pasting into the markdown file I can now additionally wrap it into a tag, but this irrelevant, because the point is that I copied something syntax highlighted in order to paste it. Let me put it this way: Visual Studio Code has a function to copy syntax highlighted code, but no way to paste it. That is simply weird. Why would Visual Studio Code - an intelligent?

IDE/Editor - force me to leave its own environment and use a different tool/editor to complete an action which is dead obvious I was about to do. I am not even sure why I have to explain this, I thought this was sort of super obvious... I mean it's literally a broken user experience right now.
Thanks for explaining though, I misunderstood your request. I will write the feature request here for future me: When copying code, like in this case: ! We write both plaintext and html to the clipboard. i.e.: and It would be good to have an action (perhaps ctrl+shift+v) to be able to paste the html variant into source files, like e.g. in a HTML file.
Thanks! That's exactly what I was thinking is missing, because VS Code allows me to copy something useful into the clipboard, but doesn't allow me to access it/pull it out again ^^. It's sort of weird when you think about it. I was even thinking that the real problem is that you copy both into the clipboard, when in reality you probably don't have to copy the plain text. After all I am explicitly asking for the formatted text and if I'd need to copy the plaintext version then I would just do a normal CTRL+C instead. I think that would massively simplyfy the feature and also be less confusing to users. There is one command which copies only the formatted text into the clipboard. Normal copy remains the same and paste remains the same as well, just pasting the one thing which you have in the clipboard. It would be so simple and straightforward that it's really elegant again. I think the idea of putting two things into the clipboard when a user actually only asks for one is what has overcomplicated it a bit. Shooting for too much when it can be kept simple. I don't know, that's just my opinion but think about it!
any news on this?
There's an extension that can do this:
This feature is now in VS code insiders. While I initially enabled it by default, it is now opt-in and will not show up normally. This is because we found it was showing up far too often There are two ways to trigger it when there is content in the clipboard: Use the command Setup a custom keybinding with :