REditorSupport / REditorSupport/vscode-R

Inappropriate format on type for `if ()` blocks

Open
#1,671 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Describe the bug

Inappropriate format on type for if () blocks

I have no idea if it is a vscode-R, languageserver, or styler issue.

To Reproduce

  1. Enable Format On Type ("editor.formatOnType": true)
  2. In an Editor, write if (TRUE) and press return
  3. A curly brace and f( are added as follows:
if (TRUE) {
    f(

Can you fix this issue by yourself? (We appreciate the help)

No

Expected behavior

No function call (f() should be added and a closing brace should be added (so the added code is not invalid).

Environment (please complete the following information):

  • OS: Fedora Linux 41
  • VSCode Version: VSCodium 1.107.18627
  • R Version: 4.4.3
  • vscode-R version: 2.8.6

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 format-on-type behavior in the vscode-R repository with the reported VS Code, R, and extension versions. Trace the format-on-type handling to determine why f( is inserted after if (TRUE); done means no function call is added and a closing brace is inserted.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.