Skip to content

Comments not formatted properly into multiple lines when there is an expression in a line before a comment when a line length including comments exceeds the maximum line width value #104

@lulunac27a

Description

@lulunac27a

When I enter an expression in a line that has a comment after an expression when the line length exceeds the maximum line width value, it doesn't formatted into multiple lines. Instead, it formatted into a single line.
For example:

0 ## here is a long long long long long long long long long long long long long long long long long long long long comment

Actual formatted output:

## here is a long long long long long long long long long long long
## long long long long long long long long long comment

Another example:

0 ## here is a long long long long long long long long long long long long long long long long long long long long comment

Actual formatted output:

0  ## here is a long long long long long long long long long long long long long long long long long long long long comment

Expected formatted output:

0 ## here is a long long long long long long long long long long long
## long long long long long long long long long comment

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('formatR'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/formatR').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions