Issue 26: Added detection of bracket and pipe blocks.#82
Merged
Ikuyadeu merged 1 commit intoREditorSupport:masterfrom Aug 16, 2018
Merged
Conversation
Member
|
@andycraig , Thank you awesome Pull Request! |
Collaborator
|
@Ikuyadeu, it looks great! Much better than what I had. Sadly, I’ve not had a chance to run it. But if it works, I say merge it. Thanks @andycraig |
Member
|
@Ladvien Thank you for your review! |
Member
|
@andycraig OK, now little fixed for maintainability, and published as the v0.6.1! |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #26
If no editor text is selected,
r.runSelectionwill check around the line on which the cursor lies and send to the R console the chunk of code necessary to make a complete code line (by matching brackets and following pipes and other operators).Some examples of code chunks it will send to the console:
If the algorithm encounters unmatched brackets, it just sends the current line.
Behaviour differs from that of RStudio in some cases. Roughly, vscode-R will send the smallest valid block of code, whereas RStudio sends the largest () or [] expression within the smallest {}. Here is an example:
The algorithm would ideally ignore brackets in strings, but I haven't implemented that feature. If it proves to be a problem in practice then it could be dealt with in a separate issue/PR.