rescript-lang / rescript-compiler

The compiler for ReScript.
https://rescript-lang.org
Other
6.7k stars 447 forks source link

Formatter is inserting blank lines in multiline strings on each format #6529

Open jquesada2016 opened 10 months ago

jquesada2016 commented 10 months ago

Thank you for filing! Check list:

Description

Having a multiline strin causes the formatter to insert blank lines above an below each line on each an every file format.

Example

Given the following example:

let s = `
  1
  2
  3
`

On the first format call, this becomes:

let s = `

  1

  2

  3

`

On the second:

let s = `

  1

  2

  3

...etc

Version

Additional Context

As I was writing this issue, I noticed this does not happen with npx rescript format, only when issuing a format call from the IDE, VS Code in my case with the official rescript plugin.

zth commented 10 months ago

This has to do with the editor line ending settings. Try changing that.

jquesada2016 commented 10 months ago

@zth Switching from CRLF to LF did seem to fix it, although this probably should still be marked as a bug?