I'm at my wits end with this. Its not just Jira, but code snippets are generally terrible replacements in HTML based windows. I get how HTML playsd with whitespace, but I feel like this has all gone back to the dark ages as far as development goes.
I just want to paste code in to a ticket comments, whether it is with the code snippet short cut button "<>" and maintain a few tabbed indentations.
Other tools like MS Teams implement this, in equally bad ways where the code is unreadable.
I'm not expecting an IDE, but the atrocious manner for code in comment mark up is stunning.
I share OP's frustration. I'm trying to copy in a chunk (20 lines) of space-indented JSON into a Jira ticket comment. No matter how I paste it, not only are indenting spaces removed, line-ends are removed, wrapping all lines of the JSON into a single line.
I have tried:
All fail identically.
I'm using Chrome on a Mac.
SOLVED?
I just tried pasting and re-copying to vi, and THIS WORKED! Formatting was preserved to the Jira comment.
I then went back to VSCode and changed the Language Mode from JSON to Plain Text, copied the text, and this also successfully pasted into the Jira comment, with indents.
So apparently VSCode is doing something "interesting" when copying code from a JSON-language editor. I repeated this experiment from Sublime editor in Plain Text and JSON language modes, and it always pasted correctly into Jira, preserving the indents and line feeds.
I suspect many of the threads complaining of this problem, that get "not reproducible" responses are reflections of the application copying the text in the first place, not how Jira pastes the text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SOLVED for VSCode
Go into Settings and search for `copyWithSyntaxHighlighting`, which is ON by default. Turn that crap OFF and resume a happy life.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Stephen Wilson, welcome to the Atlassian Community.
I've been using the code snippet, and it works fine for me. It gets a bit messy if it's a large snippet, but I'd say it probably shouldn't be there if it's a large one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.