Copying and pasting code from Rider adds tabs after first line

I'm copying the code from Rider to Github Wiki and after paste it looks something like this:

You can see how after the first line, there are added tabs that I don't need. How can I fix it? Using plain text copy/paste doesn't work.

0
10 comments

Hello, 

Apologies for the late reply - this ticket slipped over our radar somehow. 

I have tried this scenario on my end, and it works well. Rider does not modify the text on copy. Could you please check if you still have this issue on the latest Rider? If so, this may be related to how GitHub wiki renders space. To confirm this, please:

  1. In Rider, enable visible whitespace (Editor → General → Appearance → “Show whitespaces”), and look at the code you’re copying.
  2. Copy the same selection.
  3. Paste it into:
    • A plain text editor that shows tabs/spaces (Notepad++, VS Code with “Render whitespace”, etc.), or
    • A simple text field that doesn’t auto-format.
  4. Compare visually and/or count characters — they should match what you see with visible whitespace in Rider.

If the characters are identical but look different in GitHub wiki, it’s purely a rendering/tab-width issue on the wiki side.

Let me know your findings, and I’d be happy to assist further.

Thanks,

Tom

0

Hello, Tom. Thank you for your reply.

I repeated the steps you described and got the same result. I see weird tabs in Notepad++ and Windows 11 Notepad. Adding the screenshots. I write code using the usual hotkey for tabs (the Tab key) and with Rider's code formatting.

 

I am also adding a screenshot of how I selected this block of code before copying it.

 

I'm using Rider 2025.3.1.

0

Hello, 

Thanks for the additional information. The problem occurs due to how the code is selected. To resolve this, please ensure you include the leading space on the first line when making your selection, as shown below:

If you need to perform this action frequently, you can use the “Extend Selection” feature (shortcut: ⌥ + ↑ on macOS). See Handle caret and select text | JetBrains Rider Documentation for more information. 

Thanks,

Tom

0

Hello, Tom. 

Yeah, it works better, but as expected, I have these tabs on the left.

I want to remove them. To do that I can press “Shift + Tab” twice in Notepad++, but I have to do this everytime I copy my code. I am writing documentation for my repository, and code examples will be very useful in it.

Is there anything I can do with Rider to improve copying? If so, please let me know.

Thank you

0

Hi Данило Скубрій 

You can try the Column Selection Mode, which will let you select in Rider the code starting from the column where your cursor is, and when you paste in NotePad++, the previous tabs will not be pasted. Do the following:

  1. Go to your code
  2. Right-click anywhere on the current Editor tab to see the context menu
  3. Select the Column Selection Mode option

  4. Then select the code block you need, checking that the longest line is covered

  5. Copy and paste it into Notepad++

Here's the full article SUPPORT-A-3253 How to copy code from IntelliJ‑based IDEs without extra leading tabs into other text/code editor.

0

Hello. Thank you for your answer. It works, but it also copies empty spaces. Better than nothing, I will use that. 

Is there a way to remove that?

0

Hi Данило Скубрій 

You mean, blank spaces after the end of text in each line? Like the example below, where hyphens represent blanks and \n the line break, so if the original code is like in the example below, and you copy it, then it'll be pasted with exactly the same blanks:

public class example{------------\n
	some text---------------------------\n
}--\n

And you need the same example to be pasted, like:

public class example{\n
	some text\n
}\n

Is that right?

0

Hello, Monica. Yes, that's right

0

Hi Данило Скубрій 

Unfortunately, there’s no setting or automated task that trims trailing spaces only on copy; text will preserve the whitespaces. So, I opened a feature request to address this gap, IJPL-237930. Please subscribe for further updates and upvote to increase its visibility.

As a workaround, you can use the Trim Leading and Trailing Spaces option in Notepad++, which may help. You can also assign a shortcut to this feature in Notepad++, so you'll have to perform just one click instead of two after pasting the code if you use the Column selection mode in Rider.

1

Thank you so much. I will wait for an update!

0

Please sign in to leave a comment.