Skip to content

Commit

Permalink
Use append to determine cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
pedropark99 committed Oct 18, 2023
1 parent 1f96a02 commit 8e14475
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,9 @@ partition_chunk = function(engine, code) {
col = as.integer(m['col'])

cursor = paste0(strrep(" ", col), "^~~~~~")
x = c("Failed to parse YAML: ", x, "\n", append(meta, cursor, row))

split_indexes = seq_along(meta) <= row
before_cursor = meta[split_indexes]
after_cursor = meta[!split_indexes]
error_message = c(
"Failed to parse YAML: ", x, "\n",
before_cursor,
cursor,
after_cursor
)

return(paste(error_message, collapse = "\n"))
return(paste(x, collapse = "\n"))
}
)
if (!is.list(meta) || length(names(meta)) == 0) {
Expand Down

0 comments on commit 8e14475

Please sign in to comment.