positron icon indicating copy to clipboard operation
positron copied to clipboard

Range collapse in editor not working properly for functions

Open pieterjanvc opened this issue 11 months ago • 0 comments

System details:

Positron and OS details:

Positron Version: 2025.05.0 (system setup) build 142 Code - OSS Version: 1.99.0 Commit: 17df8dd67df471d39688fc6cd02e3f23543b4d72 Date: 2025-05-05T15:59:18.321Z Electron: 34.3.2 Chromium: 132.0.6834.210 Node.js: 20.18.3 V8: 13.2.152.41-electron.0 OS: Windows_NT x64 10.0.19045

Interpreter details:

R 4.4.2

Describe the issue:

When formatted functions with many arguments exceed the desired page width, arguments are aligned below each other (see function3 below) by styler. However, when you then try to collapse these functions to hide their body in the editor (using the downward arrow next to the line number), only the argument section collapses and not the body. This does not happen when the arguments fit on a single line, in that case the collapse is correct.

Screenshot of incorrectly collapsing functions in the editor

Steps to reproduce the issue:

Copy paste the following functions into an R script in Positron, then collapse each function to hide its body.

function1 <- function(functionArgument1) {
  print("Does collapse in Positron")
}

function2 <- function(
  functionArgument1
) {
  print("Does NOT collapse in Positron")
}

function3 <- function(
  functionArgument1,
  functionArgument2 = 5,
  functionArgument3 = NULL
) {
  print("Does NOT collapse in Positron")
}

Expected or desired behavior:

All functions should hide their body when collapsed, irrespective of the formatting.

Were there any error messages in the UI, Output panel, or Developer Tools console?

No

pieterjanvc avatar May 28 '25 13:05 pieterjanvc