posit-dev / posit-dev/positron

extra brackets inserted after navigating away from area

Open
#8,341 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: completions enhancement lang: r support
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

System details:

Positron and OS details:

Positron Version: 2025.07.0 build 170
Code - OSS Version: 1.100.0
Commit: cbe897b1dd265d94ddf90fcbd9661f2a816fdff9
Date: 2025-06-23T03:43:23.429Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.12.10-76061203-generic

Interpreter details:

R 4.4.1

Describe the issue:

If I write code involving brackets, matching brackets are inserted just fine and highlighted and colored to match, awesome.

If I navigate away from the code using brackets, and then come back to the code, and type a closing bracket again (pedantic, I know, but that's how I work), extra brackets are inserted.

This does not happen in RStudio (confirmed in RStudio version 2025.05.1+513)

Steps to reproduce the issue:

test_data = rnorm(100, sd = 20)

subset_data = test_data[1:50]

Type the code into a .R file, and then go back to modify the rnorm code to be:

test_data = rnorm(100, sd = 20, mean = 100)

While typing the last bracket (again). An extra bracket will be inserted.

Expected or desired behavior:

The extra bracket isn't inserted.

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

I don't think so, beyond the extra bracket being highlighted as not having a matching brace.

-->

https://github.com/user-attachments/assets/d6f457e6-4025-4516-809d-b6229b844ca6

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

Reproduce the issue in a .R file using the provided rnorm example, navigating away before typing the closing bracket again. Trace the editor's bracket-pairing behavior from that reproduction; done means returning to the code no longer inserts an unmatched extra bracket.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.