I cannot seem to get the editor to use spaces instead of tabs for its auto indentation. I have tried setting Lines.UseSpaces = true but this does not seem to have any impact on the auto indentation. I want to make the editor act as much like the default VS and VS Code in terms of formatting as possible and both of these use 4 spaces. Can you please advise on how to configure the editor to use spaces? Thanks.
Hi,
Could I ask you to provide us with the demo project where this issue can be reproduced?
We tried the following changes to our RoslynSyntaxParsing quick start project:
private void Form1_Load(object sender, EventArgs e)
{
…
csharpSource.Lines.UseSpaces = true;
}
After this change, the insertion of the tab characters automatically converts them to four spaces. Same with the line indentation (and in case you do document format with Ctrl + K + D, all tabs are converted to spaces as well).
I’ve also temporarily set syntaxEdit1.WhiteSpace.Visible to true to draw tabs and spaces in the editor differently.
Regards,
Dmitry
I think I have this working. Setting the property on the source rather than the editor seems to resolve the issue I was having. Thanks for your help.
1 Like