Skip to content

r.removeLeadingComments fails when two lines of preceding comments are interrupted by a blank line #1417

@jbullock35

Description

@jbullock35

Describe the bug
r.removeLeadingComments usually removes comments on preceding lines when those lines are submitted to the terminal. But if a line of R code is preceded by three lines that have a specific configuration—a comment, followed by a blank line, followed by another comment—the second comment will be submitted to the terminal even if r.removeLeadingComments is TRUE.

To Reproduce

  1. In settings, enable r.removeLeadingComments
  2. Send this code to the terminal:
# comment 1

# comment 2
print("When you submit this line to the terminal, the second comment will be submitted, too.")

You will see that "#comment 2" has been submitted to the terminal, even though it shouldn't be.

Can you fix this issue by yourself? (We appreciate the help)
No, I'm afraid not.

Expected behavior
In the example above, the print line should be submitted to the terminal, but no comment should be submitted.

Environment (please complete the following information):

  • OS: Windows 10
  • VSCode Version: 1.82.0
  • R Version: 4.3.1
  • vscode-R version: 2.8.1

Additional context
Related to #1244 and #1245.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions