Visual D issues and suggestions
Rainer Schuetze
r.sagitario at gmx.de
Wed Oct 24 06:59:39 UTC 2018
On 22/10/2018 22:58, Laurent Tréguier wrote:
> On Monday, 22 October 2018 at 17:50:04 UTC, Rainer Schuetze wrote:
>> I was considering integrating dfmt at some point but it seems
>> formatting just a selection doesn't work too well with it.
>
> I was able to do some decent (at least, from I've tested it seemed
> decent) selection formatting with dfmt. I don't know how formatting is
> handled in Visual Studio, but if it's similar to VSCode (which is
> basically just text replacement), then it might be possible to do the same.
> I simply do a diff between the code before and after formatting, to
> extract the portions of code that have actually changed, and then I only
> apply the changes affecting the selected zone of text.
> It's certainly not the most efficient way to do it, as it still requires
> formatting the whole file in the background, but it works.
Thanks for the hint. I guess the diff only works if the rest of the code
is already formatted according to the dfmt rules?
Visual D only changes indentation so far, no reflow with insertion or
removal of line breaks. IMO all reformatting tools produce strange
results, including clang-format, so I usually avoid these. I'm still on
the fence whether an integration of dfmt would be a good thing...
More information about the Digitalmars-d-ide
mailing list