Two VS issues

This forum is meant for questions and discussions about the X# language and tools
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Two VS issues

Post by robert »

Guys,
A few remarks:

1) Can you please stop bashing VS, especially since a lot of what you are complaining about is not the fault of VS but the result of our choices (from Fabrice and me).
The indenting inside the editor (both while typing and when choosing Format/Document) is controlled by OUR LanguageService component.

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. These 2 settings are controlled by VS.
These settings disable the indenting while typing done by the X# LanguageService.

If you set the option to "Smart" then the formatting code inside our language service gets activated. This is almost the same code that is run when you choose Format Document from the menu. At least it is driven by the same set of rules.
But since Format Document can take a bit more time, it processes all the lines and can therefore start by the first line in the file to determine the current "context".
The "Format wile typing" tries to change as little as possible for performance reasons.

3) If you have a clear example of where "Smart" is not doing what it is supposed to do then share that with us, together with the settings that you have used.
Remember that if there is an .editorconfig file in the solution tree then the settings in this file may override what's in the Tools/Options Text Editor/X#/Indentation page.
The settings inside .editorconfig are documented here: https://www.xsharp.eu/help/_editorconfig-files.html

4) Aligning RETURN to the METHOD keyword would only work if RETURN is indeed the last statement in the statement list.
But if your code ends with

Code: Select all

  
   IF SomeExpression
       RETURN TRUE
   ELSE
      RETURN FALSE
   ENDIF
Then we cannot automatically align the RETURN statement with the METHOD statement. And believe me, many people use that kind of code.

5) In theory everything is possible in the VS editor. However it is sometimes complicated to do that AND maintain good performance.
We also want to make sure that we have one set of code that works in multiple versions of VS, so we sometimes cannot use
the "latest and greatest" feature in our language service.

That is why WE have chosen to align ENDIF with IF when you press ENTER. We could have monitored the current line of text and
align immediately when you close a keyword such as ENDIF (by typing a space, tab or enter) but we have chosen not to do that.
In the VO Editor we have used a component called CodeMax that took care of all of that. And we had control of everything. So that was much easier.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Two VS issues

Post by ic2 »

Hello Robert,
robert post=23949 userid=253 wrote: 1) Can you please stop bashing VS, especially since a lot of what you are complaining about is not the fault of VS but the result of our choices (from Fabrice and me).
...
In the VO Editor we have used a component called CodeMax that took care of all of that. And we had control of everything. So that was much easier.
So still a good reason to bash VS then:)

robert post=23949 userid=253 wrote: 4) Aligning RETURN to the METHOD keyword would only work if RETURN is indeed the last statement in the statement list.
But it doesn't. I am not talking about a return within an if/endif. I am truly speaking about the last Return of a method. I start the next method and immediately Return indents to where it should not be.

And there's more. I have e.g.

Code: Select all

LOCAL n as dword
When I press <Enter> after that statement the next local indents instead of remaining aligned with the previous local (which aligns to the margin like the method).

I find this less annoying than having to remove multiple characters (tabs, returns) after an ENDIF, but I would definitely consider it a step forward if I needn't remove indents before <Returns> and Locals.

Dick
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Two VS issues

Post by robert »

Dick,
Did you really read my message ?
- I was not joking when I asked to stop bashing.
- I asked for examples including settings. Your complaint about the indenting after the LOCAL statement does not have that. It also misses context. What is before the LOCAL statement ?
- Aligning the return statement (or whatever the last statement is) with the METHOD keyword is not coded, so it is not going to happen. If you want something that aligns with method then use END METHOD

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Two VS issues

Post by ic2 »

Hello Robert,
robert post=23964 userid=253 wrote: - I was not joking when I asked to stop bashing.
If you are so sensitive about what I write about VS...whatever..
robert post=23964 userid=253 wrote: - I asked for examples including settings. Your complaint about the indenting after the LOCAL statement does not have that. It also misses context. What is before the LOCAL statement ?
Another local statement. With smart indent on. EDIT: regardless the INDENT settings (it also happens with all checkboxes unchecked)

I have reinstalled 2.12 and there it doesn't happen. Also the Return doesn't indent when I press <Enter>.

So for me it's solved.
robert post=23964 userid=253 wrote: - Aligning the return statement (or whatever the last statement is) with the METHOD keyword is not coded, so it is not going to happen. If you want something that aligns with method then use END METHOD
I am not particularly looking for something to add which is not needed so it aligns nicely with METHOD/FUNCTION..

EDIT: to make myself more clear:

I wanted Return to remain aligned. With that I mean that Returns need to remain where it is and not indent when I press <Enter> what it does do now and not in 2.12. So you write "is is not coded so it is not going to happen" but to me it looks that it is codes since 2.13 and it is doing something it shouldn't (and didn't).

As it works fine in 2.12 it is solved for me and it partly saves me frustration. If everybody else doesn't care I understand that you are not going to look further into it.

Dick
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Two VS issues

Post by ic2 »

Hello Chris,
Chris post=23926 userid=313 wrote: Oh, I meant about the problem with creating the click event.
.
I have tried a doubleclick on a pushbutton, both on the "Devteam" test program and on another form of the project I was working on. It worked in both cases. Not sure why it didn't on an earlier occasion. Maybe I can collect more info if it happens again..

One note is that this is how the inserted method (=first 3 lines) looks. Return is 3 tabs inserted, end method 2 and not aligned with "Private".

What I think happens is that it is related to the End Class / End Namespace . But in that case, the first "Private" line should align with End Method I'd say.

Code: Select all

Private Method DoSomething_Click(sender As System.Object, e As System.EventArgs) As Void Strict
			Return
		End Method
    End Class
End Namespace
Dick
User avatar
Chris
Posts: 4900
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Two VS issues

Post by Chris »

Hi Dick,

Yeah, I've seen this, too, it's not right indeed. I suspect it will not be easy to make it always work as expected with so many different indenting options available, but will log this for Robert to have a look into it.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply