Skip to content

Remove outdated line and col information - #218

Merged
lorenzwalthert merged 1 commit into
r-lib:masterfrom
lorenzwalthert:start_token2
Sep 28, 2017
Merged

lorenzwalthert merged 1 commit into
r-lib:masterfrom
lorenzwalthert:start_token2

Conversation

@lorenzwalthert

@lorenzwalthert lorenzwalthert commented Sep 22, 2017 •

Copy link
Copy Markdown
Collaborator

Now that we have closed #112, we could remove the col and line columns. The only problem is that we need to preserve the number of empty lines before the start of any content, which was done using line1 so far. One way is to extract the starting line from the nested parse table, do the processing pass the number of blank lines to serialization function.
Alternatively, we could add a start token at the top level of the nest, but that brings additional trouble: We'd have to check in every spacing rule that the token before is not the start token, otherwise we will add spaces before certain tokens, e.g. "{}" will become " {}". I think that's less elegant.

I also thought about adding the start line as an attribute to the parse table, but it seems that keeping the attribute attached to the parse table through all transformations is not necessarily more elegant.

This PR closes #147.

Note that in enrich_terminals(), the updated line and col information is added again.

@lorenzwalthert lorenzwalthert changed the title Start token2 Remove outdated line and col information Sep 22, 2017
@lorenzwalthert
lorenzwalthert force-pushed the start_token2 branch 2 times, most recently from 60c9cf1 to 311ff19 Compare September 28, 2017 18:00

@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, looks good. I like find_start_line(), and the way it is used.

@lorenzwalthert
lorenzwalthert merged commit 82f58ef into r-lib:master Sep 28, 2017
@lorenzwalthert
lorenzwalthert deleted the start_token2 branch September 28, 2017 21:02
krlmlr added a commit that referenced this pull request Oct 23, 2017
- Hotfix: utf8 should not be verbose (#245).
- Allow styling of Rmd files(#233).
- Remove duplicate @family (#244).
- Fixing token insertion (#242).
- Capitalize Addin titles (#241).
- Explicit `NULL` creation to make styler compatible with R3.2.0 (#237).
- Improve vignettes (#232).
- Allow exclusion of files with `style_pkg()` and `style_dir()`.
- Correct styling with long strings (#230).
- Add tools for re-indenting tokens (#217).
- Math token spacing (#221).
- Remove outdated line and col information (#218).
- Empty input for styling does not cause an error (#227, #228).
- Tools to insert tokens + application on `if`-`else` clauses (#212).
- Improve example in documentation (#222).
- Fix spacing around in (#214).
- Maintenance: renaming functions / files, extend helper, documentation, if_else etc. (#204).
- Disallow line break after ( for function calls (#210).
- Preserve space between `!` and bang (#209).
- Simplify RStudio Addin (#208, #211).
- Indention based on square brackets (#207).
- Add vignette on introducing styler (#203).
- Indent function declaration without curly braces correctly (#202).
- Fix indention in if-else statement (#200).
- Sorting key (#196).
- Use safe sequences (#197).
- Fix space between two commas (#195).
- Keep single-line pipes on one line (#74).
- Remove tidyr and dplyr dependency (#182, #183, @jimhester).
- Fix parsing inconsistency (#188).
- Substitute create filler (#190).
- Introducing class vertical (#189).
- Adapt line break rules (#172).
- Fix `R CMD check` (#185).
- Force argument evaluation for proper error handling (#179).
- Add nonstrict version of set_space_before_comment (#174).
- Add installation instructions to README (#175).
- Addin to style highlighted region (#143).
- Improve spelling (#168).
- Add coverage badge
- Change badge from WIP to active
- Add the number of files to message (#166).
- Improve documentation (#164).
- Add informative messages while styling files (#165).
- More examples in help file (#161).
- No line breaks after pipe if comment is next token (#160).
- Fixing spacing around `!` (non-bang-bang) (#157).
- Finalize function documentation (#154).
- Review vignette (#158).
- Update bang-bang rule (#156).
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.

Remove outdated col and line information Create key for sorting

2 participants