How to change indentation to use two spaces?

Probably a basic question but I didn’t really find an example in the docs or the samples. (Nor by blindly poking around the Editor, CsParser and IRoslynRepository properties and functions).

I want to use 2 spaces for indentation instead of tabs (or 4 spaces). Is there a property or something I can set to achieve this?

Hi Bob,

Parser uses the following settings passed on from the editor: Lines.UseSpaces and Lines.TabStops.
To set indentation/formatting to use two spaces, you will need to set these properties:

            syntaxEdit1.Lines.UseSpaces = true;
            syntaxEdit1.Lines.TabStops = new[] { 2 };

Kind regards,
Dmitry

1 Like