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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding R language support for function call split/join #172
Adding R language support for function call split/join #172
Changes from 12 commits
512770c
823b9df
5e723f2
2a67eab
f39e2dd
148438c
2e124ab
0e457e7
3b1a346
4596395
1a02d48
d54e320
e78350b
cfa5b6c
28c8298
2f16d40
dc0dd9b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an interesting approach, and it does seem to work reliably for these cases. Still, I've left it as a private/script-local function, because it's not used anywhere else, and I'd really like to have multiple use cases to decide what a sensible interface for it could be.
For instance, neither the
mask
andinserts
are being used right now. Is an array of booleans a useful interface formask
? How areinserts
going to be figured out, since they're not used at all right now? I would avoid these extra parameters until they're actually used in practice.But as a private function, this is fine -- if and when I end up using it for something else (or get a PR using it), it might be a good point to move it to the shared
sj.vim
file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, apologies for letting those slip through. I had used them at one point in the implementation and had forgotten to go back through and clean up the interfaces.
The intention was that
mask
could be used to indicate when a part of the replacement draws its origin from the original text. For some splits/joins the content of the code changes, so it's necessary to mask portions out from being used to try to align the cursor.inserts
was used in conjunction with this to specify how many characters need to be inserted between lines to properly align the cursor. An example might be:I never settled on something that I was particularly happy with to accommodate more comprehensive rearrangements and ended up scrapping the attempts.
I'll clear these vestigial bits out and leave it for another exercise to try to handle non-whitespace or non-sequential rearrangments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this test is failing. I tried debugging it, but haven't been able to reproduce the failure. It seems to be an issue with the trailing
)
's indentation, which my setup indents to the same indentation level as theprint
line, but the test suite is indenting to the same indentation as the arguments.I have a few settings set on my machine that might be causing issues. The default R language
indentkeys
does not contain0)
, meaning new lines starting with ) aren't automatically reevaluated for indentation. Using the defaultindentkeys
, I believe the expected output should be as follows, but I'm still trying to hunt down where I might have masked this setting to be able to reproduce it.I believe this is an issue with my system settings not reflecting the unit test environment and not an issue with the code. I'm happy to help dig into it more, but it would be very helpful if you wouldn't mind adjusting the expected result to reflect whatever the default indentation produces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem has to do with R indentation differences between Vim versions -- the build uses 8.0.1453, which seems to indent the closing brackets like this. I've vendored R support, so that the build has a consistent version.