-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styling resulted in code that isn't parsable. #1070
Comments
Thanks for reporting, and also illustrating the workaround. Definitely a bug. |
I supspect that it has to do with how new lines are added or removed around curly braces. I note that the R parser does not tolerate all ways you can potentially handle these. In addition, it would be useful if the output would also include the code that can't be parsed, instead of just this message. |
Slightly more minimal reprex (suitable for testing): code <- "{{
# x
}}"
styler::style_text(code)
#> Error in `value[[3L]]()`:
#> ! Styling resulted in code that isn't parsable. This should not happen. Please file a bug report on GitHub (https://github.com/r-lib/styler/issues) using a reprex. Created on 2022-11-24 with reprex v2.0.2 This code is styled to parse(text = "{{ # x }}")
#> Error in parse(text = "{{ # x }}"): <text>:2:0: unexpected end of input
#> 1: {{ # x }}
#> ^ Created on 2022-11-24 with reprex v2.0.2 |
Thanks guys. Of course, I should have known that line breaks can never be removed when they move code behind a comment... |
Hi there!
Thank you for your ongoing work on this great package!
Dealing with legacy code, I encountered code like this:
Created on 2022-11-24 with reprex v2.0.2
Interestingly enough, removing the comment
#Label "seit dd.mm.yyyy"
resolves this issue.Created on 2022-11-24 with reprex v2.0.2
Thought this might be useful, cheers!
The text was updated successfully, but these errors were encountered: