Skip to content

Commit 0195f3f

Browse files
remove redundant line / col columns for later row-binding.
1 parent ab9f7e8 commit 0195f3f

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

R/parse.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ ensure_correct_str_txt <- function(pd, text) {
7777
problematic_strings$text <- NULL
7878
problematic_strings$short <- NULL
7979
new_strings <- merge(problematic_strings, parent_of_problematic_strings,
80-
by.x = "parent", by.y = "id"
80+
by.x = "parent",
81+
by.y = "id",
82+
suffixes = c("", "parent")
8183
) %>%
8284
as_tibble()
8385

@@ -87,8 +89,12 @@ ensure_correct_str_txt <- function(pd, text) {
8789
"Please file an issue on GitHub (https://github.com/r-lib/styler/issues)",
8890
), call. = FALSE)
8991
}
92+
names_to_keep <- setdiff(
93+
names(new_strings),
94+
paste0(line_col_names(), "parent")
95+
)
9096
bind_rows(
91-
new_strings,
97+
new_strings[, names_to_keep],
9298
pd[is_unaffected_token, ],
9399
pd[is_parent_of_problematic_string, ]
94100
) %>%
@@ -115,8 +121,8 @@ identify_insufficiently_parsed_stings <- function(pd, text) {
115121

116122
#' @importFrom purrr map2_lgl
117123
lines_and_cols_match <- function(data) {
118-
left <- paste0(line_col_names(), ".x")
119-
right <- paste0(line_col_names(), ".y")
124+
left <- paste0(line_col_names(), "")
125+
right <- paste0(line_col_names(), "parent")
120126
map2_lgl(left, right,
121127
two_cols_match,
122128
data = data

tests/testthat/parsing/long_strings-in_tree

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)