-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simply let the handler() function use location info (
loc
) directly …
…without adding `at lines`
- Loading branch information
Showing
2 changed files
with
1 addition
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: xfun | ||
Type: Package | ||
Title: Supporting Functions for Packages Maintained by 'Yihui Xie' | ||
Version: 0.43.1 | ||
Version: 0.43.2 | ||
Authors@R: c( | ||
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")), | ||
person("Wush", "Wu", role = "ctb"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1182e51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cderv Just FYI since this is relevant to quarto: in the last release of xfun, I accidentally added the phrase "at lines" to the error message for knitr. The consequence is that quarto will be unable to parse or adjust the error line numbers: https://github.com/quarto-dev/quarto-cli/blob/6f233b161d770a76db9b5b3a7755fd8f88641ff3/src/execute/rmd.ts#L148 Therefore the line numbers will be incorrect with xfun 0.43 and knitr 1.46. This commit of xfun has fixed the issue.
It took me quite a few hours to figure out why the line numbers were off. During debugging, I have realized for the first time that quarto would first write
.qmd
to.rmarkdown
and then knit the.rmarkdown
file: https://github.com/quarto-dev/quarto-cli/blob/6f233b161d770a76db9b5b3a7755fd8f88641ff3/src/resources/rmd/execute.R#L20-L29 This will append some extra\n
around code chunks, so the line numbers of.rmarkdown
are not the same as.qmd
. I didn't try to understand why extra empty lines are needed, but it means users can't easily get the line numbers of.qmd
viaknitr:::current_lines()
, since knitr only sees.rmarkdown
but not.qmd
. I discovered this problem when I was trying to record the execution time of code chunks and their line numbers in.qmd
. Then I found the line numbers were off by some numbers.Anyway, this is not a big problem. I can probably figure out the line number mapping. I just want you to be aware of the xfun issue, in case someone else report this problem. I think I'll make a new release of xfun in a couple of weeks.
1182e51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update on this !
I don't think the empty lines are needed, so I can try fix this. Otherwise, I know we have some mapped string logic in Quarto already so that the correct lines number for source is ok when using tools like OJS cells.
So we may need to do the same logic for knitr.
I'll record this as an improvement to be made in quarto. Thanks !