Skip to content

Change code block detection to include parentheses#1269

Merged
andycraig merged 1 commit intoREditorSupport:masterfrom
andycraig:code-block-parentheses
Dec 4, 2022
Merged

Change code block detection to include parentheses#1269
andycraig merged 1 commit intoREditorSupport:masterfrom
andycraig:code-block-parentheses

Conversation

@andycraig
Copy link
Copy Markdown
Collaborator

Closes #437
Closes #1104

Currently, when cursor is on line 2 or 3 of the below code and R: Run Selection/Line is used, only lines 2-3 are sent to the console and a syntax error occurs. This PR causes all four lines to be sent to the console, fixing the error.

list(
    1,
    2
)

This also changes existing behaviour in cases like the below code. Currently, when the cursor is on line 2, only x = 1 is sent to the console. This PR causes all three lines to be sent to the console instead.

list(
    x = 1
)

This new behaviour is more consistent with RStudio. This can be seen in two of the changed unit tests, which directly compare RStudio and vscode-R behaviour.

Copy link
Copy Markdown
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely!

LGTM

@andycraig
Copy link
Copy Markdown
Collaborator Author

@renkun-ken Thanks for the review! I'll merge now.

@andycraig andycraig merged commit 4f6dc49 into REditorSupport:master Dec 4, 2022
@andycraig andycraig deleted the code-block-parentheses branch December 4, 2022 07:21
@andycraig
Copy link
Copy Markdown
Collaborator Author

@renkun-ken CI test stage failed but it's not the error I would have expected if the unit tests themselves had failed. (I ran the unit tests before making the PR.) I'm a bit unsure what I need to do for this error. Any ideas?

https://github.com/REditorSupport/vscode-R/actions/runs/3612227354/jobs/6087201321

@renkun-ken
Copy link
Copy Markdown
Member

It occurs occasionally. It usually resolves on its own when re-run.

@andycraig
Copy link
Copy Markdown
Collaborator Author

@renkun-ken I see you re-ran it and it passed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Control + enter within a Pipe does not execute the entire code block Run Selection/Line fails when some lines end in commas

2 participants