Indentation

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
User avatar
Kees Bouw
Posts: 124
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Indentation

Post 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?
User avatar
Chris
Posts: 4978
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Indentation

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Kees Bouw
Posts: 124
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Indentation

Post 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?
User avatar
Chris
Posts: 4978
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Indentation

Post 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?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Indentation

Post by robert »

Guys,
Please see my reply here:
https://www.xsharp.eu/forum/public-prod ... -vs-issues

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Kees Bouw
Posts: 124
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Indentation

Post 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.
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

Indentation

Post 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 2354 times
Video:
ScreenRecorderProject1.zip
(6.86 MiB) Downloaded 172 times
Best regards,
Leonid
Best regards,
Leonid
ic2
Posts: 1863
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Indentation

Post 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
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

Indentation

Post 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 2354 times
Best regards,
Leonid
Best regards,
Leonid
Post Reply