xsharp.eu • Visual Studio making a mess of my code
Page 1 of 1

Visual Studio making a mess of my code

Posted: Thu Oct 31, 2019 11:40 pm
by ic2
I've seen this before and now Kees experienced the same. Without a reason/action (at lest none we realized) spaces in a program are replaced by tabs. I am not talking about indentation tabs. These get replaced by spaces in the copied content if you copy a line (one of the many reasons why I hate Visual Studio so much). So that's already bad enough. But VS can make it worse:

Here we see also that strings have tabs inside, e.g.

AddToLog("Program is already running - do not continue because the other program was still active: " + cLastLoggedDate+" "+cLastLoggedTime, True) // Log & stop

There are big gaps between the words in the string -which unfortunately is not visible in this forum (only when I edit it!) - these used to be 1 space and are now 1 tab!

Edit/Advanced, Untabify selected lines does nothing to reverse it (nor does Edit/Advanced, Tabify selection cause the problem).

I know how to reverse it (Edit/Find/replace, quick replace or Ctrl H, enter t (tab) in the Find box and click the .* button (Wildcard), space in the Replace box and then Alt A (second button after 2nd box). Then select all, Shft tab until everything is unindented, then Edit/Advanced, Format document - note that Format Selection doesn't work in X#) and then select all and Shift Tab twice because I don't like the way VS indents (it also indents all my methods between the End Class and End Namespace).

But my main question is: does anyone has an idea how VS created this mess?

Dick

Visual Studio making a mess of my code

Posted: Fri Nov 01, 2019 2:16 am
by Chris
Hi Dick,

I have never seen this, but could be a bug doing this accidentally in some specific circumstances. I assume you are absolutely sure you did not manually did a global search & replace of spaces to tab! :)

When that happened, didn't you notice it? If you had then existed without saving, then I guess there would be no problem. Anyway, if it ever happens again, please try to remember exactly what you did prior to that, like any command you used, if you edited a window or similar etc.

About indenting, in Options/Text Editor/XSharp/Intellisense you will find some options to adjust how indenting works, especially the "Align inner content in METHOD..." might be helpful to you.

Visual Studio making a mess of my code

Posted: Fri Nov 01, 2019 10:44 am
by TerryB1
Hi Dick/Chris

I have been using VS for some time and like Chris have never seen this.

But as things move on - transitions to Net Core and so on - I am more and more of the opinion that .Net Languages such as XSharp, deserve their own, dedicated IDE.

Easy to say, time consuming to bring into effect I know.


VS itself is becoming hampered by its past. By this I mean that some of the prompts/diagnostics are no longer as clear (in today's environment) as they used to be and rely on user background for unambiguous understanding. OK perhaps for many here, but not so good for those new to things who may be encountering Assemblies (nomenclature etc for the first time).


A dedicated, evolving IDE is indicated.

My guess is that some ambiguous prompt has given rise to Dick's problem.

Just my two pen 'orth.

Terry

Visual Studio making a mess of my code

Posted: Fri Nov 01, 2019 11:38 am
by FoxProMatt
JetBrains is a popular vendor for .Net libraries and tooling.

They have a new IDE for .Net called “Rider”. It’s a paid product.

Check it out here:

https://www.jetbrains.com/rider/

Visual Studio making a mess of my code

Posted: Fri Nov 01, 2019 1:59 pm
by ic2
Hello Matt, Terry,

I agree that a dedicated IDE is better, hence my strong preference for the VO IDE; for X# Xide is of course the best substitute. If JetBrains is worth the (considerable) costs (€349.00/user 1st year; €279.00 /2nd year; €209.00 /3rd year onwards)? I could not directly find why users would choose the paid IDE above a free VS (for most users) despite my general aversion against VS.

What I mainly miss in VS, present in VO

The best features of the VO IDE is the repo where every entity can be separately edited, or any combination of a few entities, contrary to VS where a full .prg (.cs etc) has to be loaded. I always use sorting on Date Changed in the entity browsers so I can quickly see, per MEF (which would be the equivalent of a VS .prg, .cs etc) which entities I changed last.It's much easier going back to the code you were editing if you can quickly click that one entity, or there is only one or a few methods in the editor open.

As far as I know, no .Net editor can do that, not even Xide or Rider as fas as I can see.

Second major advantage of the VO IDE is that Intellisense is way better; e.g. typing a few characters, even in comments, of a variable name or reachable method/function pops up the full name to autofinish. Number 3 is that both (Re)starting and compiling is much faster than anything in VS. Number 4 is that everything is logically accessible with often all information I need. In VS I keep moving windows (like the Find/Find Results window which you can not minimize) - despite trying every combination of docking or adding it on a fixed place in the IDE, where it often proves to be moved on a certain moment. IN the search results I can not see in which method.function a hit is found, only the full .prg/.cs etc where it is found, making search results useless as you nee to open each individual search result. Final important issue in VS are surprises like this spaces replaced by tabs.

What is better?

Is there anything good in VS compared to VO? Yes.
1 The option to collapse anything between a full method or all
2 Peek definition
3 Code Lens, available from VS2019 in the Community edition, showing you how many times a method was used and allowing you to open it there.

This probably make you wonder how I think about the many features in VS which are not in VO. I did try or study quite a few but I have not found many really improving my work.

Unsure about:

One thing I have lost a bit. Maybe someone can remind me. How is it again with Edit and Continue and Step Back during debugging? I thought it was not supported in earlier version but I remember that it does or could work in X#/VS Community, but I couldn't find back how.

Compare table

This lead me to updating my comparison between VO and X# a bit. The many 'reds' in VS compared to the many 'greens' for VO is certainly one of the reasons I am still not in a hurry to stop with VO.

Here it is should anyone be interested.

https://www.ic2.com/cavo/VoVSXSharp.html

And if you did, please feel free to prove me wrong on any of the points.

Dick

Visual Studio making a mess of my code

Posted: Fri Nov 01, 2019 3:41 pm
by TerryB1
Hi Dick

I'm not in a position to sensibly comment in detail.

But I do agree with the general points you make.

Your comparison chart would seem a good basis for an IDE Requirement Spec.

By the way why is "Collapsing Code = Not Possible" Green?!

Terry

Visual Studio making a mess of my code

Posted: Tue Nov 05, 2019 2:56 pm
by ic2
Hello Terry,
Terry wrote:Hi Dick
By the way why is "Collapsing Code = Not Possible" Green?!
Terry
You're right, that should be red. I changed it. Current number of green/orange/red for VO is 23, 7 and 13 versus 13, 16 and 14 for VS.

About 2 years ago I was approached by a senior VS manager after I filled in the feedback form. I invited him to watch me work with VO (some daily tasks) and then do the same in VS. He had to admit that almost everything worked faster in VO (he called VO "indeed lightning fast") but of course there is little which can be done about it, although with later VS versions I upgraded a few of the colours from red/orange to orange/green. There are certainly many, many advantages of VS above VO, but not for the basic tasks I do all day unfortunately.

If the time comes that I will have to quit VO, and given the progress an quality in X# and the chance that we may come across issues with VO programs which are difficult to solve, the only thing I can do is enjoy the 13 "green" points (from which 7 are red or orange in VO). It is even possible that after a long time working in VS I may fool myself as well thinking I am more productive. This is called cognitive dissonance or perhaps more precisely: choice blindness.

Dick

Visual Studio making a mess of my code

Posted: Tue Nov 05, 2019 3:22 pm
by wriedmann
Hi Dick,

again: there is a fast solution for your VS problem: it is called XIDE.
You can also mix between XIDE and VS if you need it.

Wolfgang

Visual Studio making a mess of my code

Posted: Tue Nov 05, 2019 4:00 pm
by ic2
Hello Wolfgang,
wriedmann wrote:Hi Dick,
again: there is a fast solution for your VS problem: it is called XIDE.
You can also mix between XIDE and VS if you need it.
I should probably plan to review the latter once more, I did try earlier but that was not so easy. A VS project isn't updated if I remember correctly when I made changes in the includes, add/change/remove .prg's, etc. I think that made me decide a mix is not a good idea.

And (also again ;) ) Xide does not support WPF. When a .net project includes windows I use WPF.

Dick

Visual Studio making a mess of my code

Posted: Tue Nov 26, 2019 1:18 pm
by cecilchamp
Thanks for the link, Matt.