rescript-lang / rescript-lang/rescript-vscode

Formatting Issue with Multi-line Comments and JSDocs in .res files

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

Nobody has claimed this yet.

Dominant language
ReScript
Stars
354
Forks
63
Avg merge
11h 29m
Merged PRs (30d)
1

Description

Description

I encounter a formatting issue when working with multi-line comments or JSDocs in ReScript using the extension. Each time I format the code, extra new lines are added, leading to inconsistent formatting. This behavior is affecting the readability and aesthetics of my code. Not only that but not being able to have JSDocs formatted correctly makes it harder to document and maintain my code base when working with ReScript.

Steps to Reproduce

  1. Write ReScript code containing multi-line comments or JSDocs.
  2. Format the code using the extension.
  3. Observe the addition of extra spaces in multi-line comments or strings.

Expected Behavior

The extension should format multi-line comments and JSDocs consistently without introducing extra spaces or new lines.

Actual Behavior

Extra lines are added each time the code is formatted, impacting the code's appearance.

Environment

  • Extension Version: 1.36.0
  • Formatter: ReScript (official) (Also happens when no code formatter is defined)
  • Visual Studio Code Version: 1.85.1
  • Operating System: X64 Windows 10.0.19045

Demonstration of Bug

image
Figure 1. Before Formatting ReScript code

image
Figure 2. After Formatting ReScript code once

image
Figure 3. After Formatting ReScript code twice

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 .res file containing multi-line comments or JSDocs, then format it repeatedly with the extension. Verify that formatting no longer adds extra spaces or new lines and that the result remains stable across repeated formatting.

Written by the indexing model from the issue text.

Assessment

Domain
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.