code-d icon indicating copy to clipboard operation
code-d copied to clipboard

Add max line width setting (resolving wrapping conflict)

Open HuskyNator opened this issue 3 years ago • 4 comments

Vscode has word wrapping settings. For as far as I'm aware, the extension however does not expose a setting for disabling/modifying the wrapping/line length behavior of the formatter (dfmt's max_line_length setting I presume).

Due to this behaviour, vscode's wrapping is essentially conflicted with. One example showing the behavior of vscode's bounded word wrapping: image Note how the line wraps around at the end of the viewport, without introducing an actual linebreak.

Upon formatting, dfmt however introduces a linebreak at it's max-line-length setting: image This is however not taking into account vscode's wrap settings (which may or may not be using the viewport width or its own max-line-width setting).

HuskyNator avatar Aug 17 '22 13:08 HuskyNator

you can set the editor.rulers setting to change the max_line_length, if you set two or more rulers, the last 2 will be used for soft_max_line_length and last one for max_line_length

WebFreak001 avatar Aug 18 '22 07:08 WebFreak001

That's odd, I thought those were purely visual. Did I mess something in a readme?

A second more specific question arises: Is or would it be possible for the extension to use the dynamic wrapping width vscode attests to the wordwrap:on & wordwrap:bounded settings?

HuskyNator avatar Aug 25 '22 16:08 HuskyNator

I don't think that's possible, but also it doesn't make sense to modify the code to linebreak, when line wrapping is enabled anyway.

editor.rulers is only really used in code-d for the max line length, it might make sense to create a separate setting for it, I personally quite like it being synced up automatically.

WebFreak001 avatar Aug 26 '22 09:08 WebFreak001

I wouldn't have known it was synched without this exchange 😅, had been searching for a setting in the D section previously.

I guess I'll just have to add 2 rules at a ridiculous width to effectively disable linebreaks.

HuskyNator avatar Aug 26 '22 12:08 HuskyNator