resharper-fsharp icon indicating copy to clipboard operation
resharper-fsharp copied to clipboard

Reformat Code Ignores @formatter:off comment

Open user9517 opened this issue 3 years ago • 3 comments

Even after enabling "Turn formatter on/off with markers in code comments" (path: File | Settings | Editor | Code Style) the formatter ignores it and still formats lines that should not be changed. For example:

// @formatter:off
let a =2

becomes:

// @formatter:off
let a = 2

user9517 avatar Dec 29 '21 17:12 user9517

Hi @Phantom1472, we use Fantomas library for formatting F# code, and with it's current design it has to be implemented there first to be available in Rider.

@nojaf What do you think about supporting such markers?

auduchinok avatar Jan 17 '22 20:01 auduchinok

Hello, this is being tracked in https://github.com/fsprojects/fantomas/issues/1704. I would like to have something in the likes of this supported.

I'm unfamiliar with the // @formatter:off syntax, so I can't say for sure we are going for this exact thing. The scope of what is possible might be limited to start with but the request is accepted in principle.

nojaf avatar Jan 17 '22 20:01 nojaf

@nojaf This syntax comes from the default settings in Jetbrains tools: image

As you can see, they also support a more general syntax (you can change these values)

user9517 avatar Jan 17 '22 20:01 user9517