Skip to content

Reformat Code of last line in chunk fails with "[…] command is only valid for R code chunks" #7508

Open

Description

@katrinleinweber

System details

RStudio Edition : Desktop
RStudio Version : 1.3.1056 (but many earlier ones have this as well)
OS Version      : macOS
R Version       : 4.0.2

Steps to reproduce the problem

  1. Insert R chunk into an .Rmd document & add some code
  2. Select last line by double-clicking it
  3. Try to Reformat Code

Describe the problem in detail

rstudio-bug-reformat-last-line

The fact that selecting the linebreak as well (cursor is on next line, before ```). Apparently, that is already considered outside of the code chunk.

Describe the behavior you expected

Reformatting the last line works, regardless of how it was selected. Maybe the formatter could even detect the actual code chunk contents by itself, so that Select all + Reformat code would be possible, just like in .R files.

Activity

  1. ronblum commented on Aug 3, 2020

    @ronblum
    Contributor

    Thanks @katrinleinweber ! I can reproduce this in RStudio Desktop 1.4.640 on MacOS 10.15.5 and going back to RStudio Server 1.2.5042 on Ubuntu 20.04. We'll check this out as we continue development of RStudio.

  2. added this to the v1.4 milestone on Aug 3, 2020
  3. modified the milestones: v1.4, Later on Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions