In JS files this extension will sometimes mess up indentation upon pasting. The circumstances under which this seems to happen is when having "editor.formatOnPaste": true enabled (something that Atom Keymap adds to your config automatically).

This is when having prettier disabled. I start out by marking the text and pressing CMD+C, place the cursor where I want to paste, and CMD+V. Everything pastes as one would expect.

This is after enabling prettier. Again, I mark the text, copy it, paste it. Split second after pasting prettier has formatted everything in a horrific manner.
I then found out that if I do not mark the last comma in the selection I want to copy+paste, it works even with prettier enabled.

module.exports = ({ config }) => {
return [
{
key: 'some value',
fn: async (req, res) => {
return 'some value'
},
},
]
}
{
"workbench.colorTheme": "Oceanic Next Italic",
"window.nativeTabs": true,
"editor": {
"formatOnSave": true,
"fontFamily": "Fira Code",
"fontSize": "16",
"fontLigatures": true,
"tabSize": 2,
"tabCompletion": true,
},
"prettier": {
"singleQuote": true,
"semi": false,
"trailingComma": "es5",
"printWidth": 100
},
// added by atom keymap
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true
// end atom keymap
}
Yep same thing happens by calling the range formatter (Format selection). FormatOnPaste calls the range formatter.
It messes the output if the trailing-comma is selected/pasted.
It throws if it is not selected/pasted.
I experience the same, also added a gif inside another issue because I first thought VS code was causing the behaviour. https://github.com/Microsoft/vscode/issues/33522
This should be fixed in prettier 1.8 (version we are now bundling)
I'm still experiencing this issue with the latest extension 1.5.0
Me too in VSCode!
I think "editor.formatOnPaste": false, fixed my issue.
"editor.formatOnPaste": false did not fix my issue.. the way it imports and formats is whack, but undo fixes it.
This worked for me: Go to VS Code Settings -> from the User Settings tab -> Text Editor -> Formatting -> Untick the first option 'Format On Paste'
same issue, very annoying
Thanks @faiz021 , that worked for me
This was driving me insane. Found the config and turned it off and I'm happy again :) Of course, now I find the fix here :)
This is still an outstanding issue on 1.9.0.
Disabling "Format On Paste" is not a good solution, but merely a workaround.
My "Format on Paste" is disabled since long time ago, but I still experience this!
Still happening... this is so annoying.
VS Code v1.36.1
I am setup "editor.formatOnPaste": true, and this is fix my issue. I am use Prettier + ESLint + Airbnb Style Guide
VS Code v1.36.1
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I think
"editor.formatOnPaste": false,fixed my issue.