xsharp.eu • Indentation
Page 1 of 1

Indentation

Posted: Tue Sep 20, 2022 6:37 pm
by Kees Bouw
Using version 2.13.2.2.

My code is aligned left, starting at char 1. Let's take these lines for example:

Code: Select all

oImageColumn := DataGridViewImageColumn{}
oImageColumn:HeaderText := ""
oImageColumn:Name := "attachment"
If I want to insert a line after the line in the middle, I place the cursor at the end of the line in the middle and press the Enter key. Then this happens:

Code: Select all

oImageColumn := DataGridViewImageColumn{}
	oImageColumn:HeaderText := ""
	
oImageColumn:Name := "attachment"
The second line now has a tab before it and the new line also begins with a tab. What could possibly be the logic in that? All lines are left aligned, why in the world are tabs inserted? I have turned off all indentation check boxes in Tools->Options->Text Editor->X#->Indentation but this did not help. Of course these lines are just examples, it happens everywhere and always.
Does anyone know how to make this stop?

Indentation

Posted: Tue Sep 20, 2022 8:16 pm
by Chris
Hi Kees,

I think there's something wrong with modifying the indentation settings, I've also seen some fishy behavior in this area.

Please restart VS and open again the indentation settings, make sure they are all disabled again (just to be sure, enable the "Indent statements inside entities" setting and then disable it again) and go back to the editor, it should work fine now. At least here, Enter on the existing lines does leave them in the beginning as intended now.

Indentation

Posted: Wed Sep 21, 2022 2:13 pm
by Kees Bouw
Hi Chris,

Sorry, I can't get it to work. I did as you suggested, several times even, but no cigar. It drives me crazy and just as with the totally inadequate search option I wonder, how can people work like this? What am I doing wrong or what am I missing? Is there perhaps another setting somewhere else that controls the indenting? It seems that while all kinds of fancy stuff is added, the most basic functions do not work properly. I must say that I am seriously considering to use XIDE, providing that this has a better editor. XIDE can handle Winforms I think? Is it possible to use both VS and XIDE (not simultaneously of course) for a project?

Indentation

Posted: Wed Sep 21, 2022 2:51 pm
by Chris
Hi Kees,

No, I am afraid it will be extremely complicated to combine XIDE and VS in the same project, especially if you are using the winforms or WPF editor. That's not the solution, you just need to get used to working in VS, like millions other developers do (admittedly, I am not one myself though).

Does this happen with all prgs that you have? CAn you send me a prg file to give it a try with? I think you said you disabled ALL options in the indentation settings, is that right?

Indentation

Posted: Wed Sep 21, 2022 3:27 pm
by robert
Guys,
Please see my reply here:
https://www.xsharp.eu/forum/public-prod ... -vs-issues

Robert

Indentation

Posted: Wed Sep 21, 2022 3:45 pm
by Kees Bouw
Hi Robert,

Thank you very much and I am sorry I did not see your reply in the other thread earlier, it would have saved me a lot of irritation. You wrote:

2) Indenting during typing is controlled by the setting in Tools/Options Text Editor/X#/Tabs. If you set the option on this page to "None" then no indenting will happen during typing. If you set it to "Block " then each line will have the same indent as the previous line.
That settings does fix it, both "Block" and "None" prevent the extra tabs. I think the "Smart" setting has room for improvement, to prevent unnecessary indenting as described.

Indentation

Posted: Thu Sep 22, 2022 12:50 pm
by leon-ts
Hi Robert,
I migrated to version 2.13.2.2 from version 2.9.1.1 and also noticed some oddities in the behavior of the VS editor, which are quite often evident. To visually show what happens when the Smart setting is enabled, I recorded a short video (attached). The video shows the pressed keys (for better analysis, it is recommended to turn on slow playback). Also attached a screenshot of the settings.
For now, I've disabled Smart mode by setting the Tabs setting to Block. But I would like to hope that in future versions the Smart mode will work better.

IDE: VS 2019 (16.11.19)
X#: 2.13.2.2

Indentation Settings (Tabs = Smart):
screenshot1.png
screenshot1.png (7.52 KiB) Viewed 2281 times
Video:
ScreenRecorderProject1.zip
(6.86 MiB) Downloaded 171 times
Best regards,
Leonid

Indentation

Posted: Thu Sep 22, 2022 4:10 pm
by ic2
Hello Leonid,

I posted a similar issue, that Return and Local indent on the previous line when you press <Enter> where these should remain left, aligned with Method/Function, at least IMO.

I wonder if you get the same issues as in the video when you uncheck all Indentation Settings? For me it didn't make any difference.

Dick

Indentation

Posted: Thu Sep 22, 2022 5:02 pm
by leon-ts
Hello Dick,
ic2 post=23979 userid=455 wrote: I wonder if you get the same issues as in the video when you uncheck all Indentation Settings? For me it didn't make any difference.
When I unchecked all Indentation settings, the behavior of the editor changed inside NAMESPACE: new lines began to align relative to the previous line, regardless of what was in the line (entity definition or its body). But the behavior didn't change in any way outside of NAMESPACE (where I type the function definition at the end of the video): there is still an incomprehensible "dance" of the text.

In general, for me, the preferred type of formatting is the one that is used in VO when applying auto-formatting (CTRL+ALT+I).

Code: Select all

FUNCTION <FuncName>
    LOCAL ...
    <BODY>
    RETURN
I got used to it back in VO and also use it in X#.
It also matches the way it is implemented in C#:
screenshot1.png
screenshot1.png (7.52 KiB) Viewed 2281 times
Best regards,
Leonid