Weird auto-formatting of code upon paste
See original GitHub issueDescription
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).
With prettier extension disabled:
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.
With prettier extension enabled and including trailing comma
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.
With prettier extension enabled an excluding trailing comma
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.

Snippet:
module.exports = ({ config }) => {
return [
{
key: 'some value',
fn: async (req, res) => {
return 'some value'
},
},
]
}
My config:
{
"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
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:29
- Comments:16 (2 by maintainers)
Top Results From Across the Web
Odd formatting when pasting text from web
My Word documents have some weird text formatting going on when pasting anything that's been copied from the web, and it happens randomly ......
Read more >How to disable auto-formatting on paste?
Hello.I'm using latest pyCharm 2.6.3If i copy-paste code from one source code file to another, pyCharm seems to apply auto formatting: it...
Read more >Odd code snippet formatting when pasting snippets into a ...
I'm noticing my code snippets are formatted in undesirable ways when I paste them into a code block - incorrect spacing is the...
Read more >Settings to copy paste with correct indentation in Visual Studio ...
A simple fix is to try Ctrl + Shift + V after copying the code.
Read more >How to Strip Formatting When You Copy and Paste Text: 5 Ways
Here's how to copy and paste without formatting, on both Windows and Mac, using several convenient methods.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think
"editor.formatOnPaste": false,fixed my issue.I’m still experiencing this issue with the latest extension 1.5.0