posit-dev / posit-dev/ark

R: Statement range provider needs to take `column` into account

Open
#714 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
337
Forks
32
Avg merge
8d 17h
Merged PRs (30d)
11

Description

From https://github.com/posit-dev/positron/issues/1464#issuecomment-1787666141

if (TRUE) { # press CMD+Enter here
    print('yes')
}; lapply(1:5, print) # You'll jump past the lapply and it wont execute

I think this is a bug on our end where we aren't taking the column into account (I didn't think we needed to).

RStudio will run both expressions in 1 CMD + Enter press. I'm not sure we want that. I feel like it would be better to stop at the l of the lapply()

Another probably related bug:

if (TRUE) 
  1 + 1 else 2 + 2 # place your cursor on the `2 + 2` and hit CMD+Enter, it will run `1 + 1`

I'm not entirely sure what this should do, but the current behavior is odd (note that RStudio is also weird here and just runs the whole 2nd line, which also fails to parse)

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 at the statement range provider and reproduce both R examples with the cursor at the shown positions, checking how the current range uses line and column. Done means the CMD+Enter range behavior is explicitly decided for both cases and matches the chosen expectations, with regression coverage for the reproductions.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.