Two VS issues
Posted: Wed Sep 21, 2022 3:18 pm
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
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
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
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