Skip to content

Allow empty {} without line break. - #261

Merged
lorenzwalthert merged 3 commits into
r-lib:masterfrom
lorenzwalthert:master
Oct 27, 2017
Merged

lorenzwalthert merged 3 commits into
r-lib:masterfrom
lorenzwalthert:master

Conversation

@lorenzwalthert

@lorenzwalthert lorenzwalthert commented Oct 25, 2017 •

Copy link
Copy Markdown
Collaborator
  • Minor simplification of code based on the insight that curly braces expressions exhibit symmetry, which in turn
  • Facilitates checking whether or not a line break should be added before and after an opening / closing curly brace respectively.

Closes #256.

@krlmlr krlmlr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I love simplifications!

@lorenzwalthert

Copy link
Copy Markdown
Collaborator Author

We could even go one step further and add the argument strict to the a function style_line_break_curly() (which would replace set_line_break_curly() and add_line_break_curly()) to handle both strict and non-strict case, as it was done with style_space_around_math_token().

@krlmlr

krlmlr commented Oct 25, 2017

Copy link
Copy Markdown
Member

Yeah, why not? That would slightly add complexity, but reduce redundant code.

@lorenzwalthert
lorenzwalthert force-pushed the master branch 3 times, most recently from 870b146 to 84543fc Compare October 25, 2017 22:41
@lorenzwalthert
lorenzwalthert force-pushed the master branch 2 times, most recently from 9645869 to 054dcd8 Compare October 26, 2017 19:10
set_line_break_around_curly and add_line_break_around_curly to style_line_break_around_curly
@lorenzwalthert

Copy link
Copy Markdown
Collaborator Author

We now need 22 lines less code to achieve the same as before and also fix #256.

@lorenzwalthert
lorenzwalthert merged commit 79ada7a into r-lib:master Oct 27, 2017
krlmlr added a commit that referenced this pull request Nov 27, 2017
- Adapt documentation (#290).
- Add roundtrip (#287).
- Fix AppVeyor builds.
- Fix token insertion / comment interaction (#279).
- Clarify labelling strategy (#285).
- Fixing and extending Rstudioaddins (#283).
- Fix eq assign parsing (#276).
- style_files -> vectorized style_file (#273).
- Refactoring (#270).
- Fix CI (#275).
- Fix covr (#274).
- Renaming files (#271).
- Handle styling of an unsaved active file (#243).
- Test R 3.1 and R 3.2 (#249).
- Allow empty {} without line break (#261).
- Wrap expr in expr before enclosing with curly braces (#263).
- Avoid checking for hard-coded dot (#262).
- Account for dependency renaming (utf8 changed to enc) (#264).
- Indention of function declaration and closing braces (#260).
- Only remove line break before closing with strict option (#252).
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.

2 participants