-
Notifications
You must be signed in to change notification settings - Fork 34
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
Indent rules for line after “{” #133
Comments
I added the file that I use to test the indentation to the github repository: And I managed to add a rule that fixed the bug you reported and did not break anything in the previous 500 lines of indent_test.R: 4b3abb8 Note: I think that the correct indentation of the closing brace is aligned with the opening parenthesis. |
I disagree. First of all, this means that the block between the braces is indented extremely widely. Secondly, it would mean that the statements inside the block are no longer indented at a multiple of Compare ( test_that('my unit test', {
▸---▸---▸---▸---▸---▸---▸--- if (some_condition)
▸---▸---▸---▸---▸---▸---▸---▸--- result
▸---▸---▸---▸---▸---▸---▸--- else
▸---▸---▸---▸---▸---▸---▸---▸--- other_result
▸---▸---▸---▸---▸---▸--- }) With: test_that('my unit test', {
▸---if (some_condition)
▸---▸---result
▸---else
▸---▸---other_result
}) |
I had made a mistake while copying you example. I did not set 'paste' and the underline was converted into
Other options control how to align comments and top level functions ( I think that the indentation is closer to what you want when For people wanting to improve the indent/r.vim script, I suggest the following:
|
I deleted from the Vim-R-plugin the files that are already distributed as official Vim runtime files. Now, there is a new repository with these files: https://github.com/jalvesaq/R-Vim-runtime Since the official runtime files are no longer in this repository, I'm closing this bug. This bug is already described in the Known bugs section of the README.md, and new bugs should be reported in the new repository. |
The indent rules for Vim-R are generally very sensible but they fail in cases such as this (testthat code, but the same situation is generally applicable):
The position of the cursor is indicated by “|”, and I think it’s uncontroversial to call this wrong: in such a case, we want to simply shift the indent by
shiftwidth
from the previous level, rather than aligning it with the previous opening parenthesis.I’ve read the FAQ and I realise this may be related to #77 but it looks sufficiently dissimilar – maybe there’s hope?
The text was updated successfully, but these errors were encountered: