Vscode-r: Newlines when sending code to Radian

Created on 28 Jul 2019  路  9Comments  路  Source: Ikuyadeu/vscode-R

See https://github.com/randy3k/radian/issues/102

When using Radian with vscode-R, R: Run Selection/Line results in whitespace-only lines before the block of code sent being sent as well. I think this is probably due to vscode-R rather than Radian, although it is interesting that it doesn't happen with the normal R console.

Currently, comment lines are filtered out before being sent to the console; it should be straightforward to filter out whitespace-only lines too.

All 9 comments

It should be fixed by simply wrapping the chunk of text with brackted paste mode markers.

I鈥檒l try the bracketed paste mode approach first (would also resolve https://github.com/randy3k/radian/issues/99). If that doesn鈥檛 solve the problem, I鈥檒l also filter out whitespace-only lines too.

A couple of developments:

  1. The extra newlines do get sent to the normal R console as well (on my Linux PC, anyway), so this is definitely a vscode-R issue and not a Radian issue.

  2. Bracketed paste mode doesn't fix this, so I have created a separate issue for issues relating to that (#117).

Reopening as the issue is fixed on Linux but not on Windows.

Changing line endings from 'CRLF' to 'LF' (bottom right of the VSCode window) results in the newlines being filtered out as desired, so it looks like the problem is that the '\r' in the '\r\n' Windows line ending is being incorrectly counted as non-whitespace.

I should be able to fix this next week.

Possibly related: when I used VSCode from my Windows machine with a remote session on an Ubuntu VM, bracketed paste mode broke with errors. May also be due to the CRLF issue you found.

image

@Hong-Revo Thank you for adding this. In that example, were you sending the two lines at the same time (i.e., by selecting them both and sending them), or separately?

Both at once. When I send each line separately, it works.

That鈥檚 good to hear, thank you for confirming. (Bracketed paste mode shouldn鈥檛 be applied to single lines so I was hoping that would be the case.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nightwingg picture Nightwingg  路  6Comments

renkun-ken picture renkun-ken  路  3Comments

michaelHL picture michaelHL  路  5Comments

gcambray picture gcambray  路  4Comments

nathaneastwood picture nathaneastwood  路  6Comments