posit-dev / posit-dev/air

VS Code Format selection does not work when selection ends with non-code

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

Nobody has claimed this yet.

Dominant language
Rust
Stars
446
Forks
32
Avg merge
16h 48m
Merged PRs (30d)
1

Description

Buggy behavior

Consider this block of R code

mtcars |> 
names()
# blank line
names(mtcars)

Selecting lines 1-3 and "Format Section" in VS Code does not do anything.

Expected behavior

Selectin lines 1-2 or 1-4 and "Format Section" in VS Code formats the code correctly:

mtcars |>
    names()

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 reproducing the VS Code Format Section behavior with the R snippet, selecting lines 1-3 so the selection ends with a blank line. Compare it with selections of lines 1-2 and 1-4; done means the 1-3 selection formats the code instead of doing nothing.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.