REditorSupport / REditorSupport/vscode-R

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

Open
#1,417 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of r.removeLeadingComments in the VSCode extension and reproduce the four-line example with a blank line between comments. Done means the print line is submitted without either comment; add or update a regression test for this sequence if the existing test structure supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.