Extension|Author (truncated)|Version
---|---|---
vscode-eclipse-keybindings|alp|0.9.6
I submitted an issue #35288 before. It's been closed because it's written in Chinese, so I re-submit in English. My English is not good, so I use screenshots more.
Indent using spaces

When copy to OneNote(desktop version) ,The spaces are gone

If "Indent using tabs", there is no problem.

Reproduces without extensions: Yes/No
The text is stored properly in the clipboard and I cannot reproduce this in Word (see below). So this looks like a OneNote specific behaviour. Nothing we can addresson the side of VS Code.

I guess the content is HTML format when copy to clipboard from VS Code. When copying content to OneNote, the performance is usually normal. Sometimes it is not normal if the content has special formats. Whether can check the code display HTML.
When I search online, I found that when copying code with highlighting from IDE to Onenote, the disappearance of spaces for indentation is frequent.
This is not urgent. Now I can first convert indentation to Tabs for copying to OneNote, then undo.
Any movement on this? Pasting into Evernote strips all the spacing :/
Same issue here. Pasting code to Evernote but no indention.
Looks like pasting into Evernote is working now. Spaces are retained. @BrambleXu what version of EN are you using? I'm using the Mac client and it says version 7.8. Also, I'm using VS Code version 1.30.2 for Mac as well. Perhaps updating both to the latest version will solve this for you.
@BrambleXu Not sure if its relevant, but I use a monospace font in EN for everything. Just figured I'd mention it.
@qodesmith I am using latest Evernote and VS code just like you. I also tried to use the monospace font in EN. But the problem still exists.
It works for users who uses Tab as indentation, not Spaces
I believe it's caused by how these programs handle spaces in HTML, actually if you copy the following line and paste it in OneNote, the leading spaces will also be trimmed.
copy me!
@yume-chan Thanks, it works for Evernot, but only with Tab indentation.
This is not the VSCode issue. This is OneNote issue. It has very poor attention at OneNote Suggestions place. https://onenote.uservoice.com/forums/327186-onenote-for-windows/suggestions/33254596-rich-text-paste And sadly to say it tends to be never fixed. (Probably there are other similar issues there - I see many duplicates for the missed line spacing option).
As for Evernote, this is the VS code issue. If setting indention with space in VS code, and pasting to Evernote, it would lose the indention. Other editors have no such problem.

Here is the link
Interestingly, if the paste function is done with the "Keep Text only" option the formatting obviously disappears but the indentation remains.
PS: The problem also occurs in the new OneNote UWP app for Windows 10.
This is not the VSCode issue. This is OneNote issue. It has very poor attention at OneNote Suggestions place. https://onenote.uservoice.com/forums/327186-onenote-for-windows/suggestions/33254596-rich-text-paste And sadly to say it tends to be never fixed. (Probably there are other similar issues there - I see many duplicates for the missed line spacing option).
Man, this is really a VSCode issue!
When Editor:Detect indentation is Off, then you type codes in vsc editor, then copy the codes, then paste in many other applications such as Word/Evernote, the indentations are lost!
But if Editor:Detect indentation is On, then do the same things, the indentations are there, not lost!
So, This is an issue of vscode, not of Evernote.
Developers of vscode, fix this issue asap please... Thanks a lot!!!
I find another thing:
When paste into Plain text editors, indents will not disappear.
When paste into Rich text editors, indents disappear!
So, I think it shouldn't be an issue of those other rich text editors. It is of VSCode.
Yes, when you use Space indentation in your code, the idents will lost in OneNote, but use Tab indentation is normal.
So you'd better convert indents to Tabs in VSCode before copy:
ctrl + shift + pConvert Indentation to Tabs
Most helpful comment
Any movement on this? Pasting into Evernote strips all the spacing :/