Some other Visual Studio things I consider...suboptimal

This forum is meant for anything you would like to share with other visitors
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Some other Visual Studio things I consider...suboptimal

Post by ic2 »

Apart from what I posted earlier I have a couple of nuisances in Visual Studio (e.g. using C#) from which I wonder if for any these a solution or setting exists that can solve it. These are the first 5, from the top of my head.

1 Position of click method created when you double click a button in WPF.

In my current C# project, this code is ironically always placed in a region called Obsolete. The cursor was not there so how does VS determine where code is placed (this is also what I mean with 'VS code is a complete mess')

2 Context help.

There is none -not off line and not on line either. All it shows it help of the Code and Text Editor. Every little thing has to be found on line by typing in text.

According to this Visual Studio user voice website, a inferior solution was offered but never delivered.:

https://visualstudio.uservoice.com/foru ... e-off-line

3 Copying an error

When I get an error I can either right click Show error help, which -sometimes- even give an answer, but again only off line. Otherwise, you can copy the error. But instead of the error, this is what I get:


Severity Code Description Project File Line Suppression State
Error CS1061 'TextBox' does not contain a definition for 'TextWithError' and no extension method 'TextWithError' accepting a first argument of type 'TextBox' could be found (are you missing a using directive or an assembly reference?) PhotOrganize D:ccodePhotOrganizeMainWindow.xaml.cs 1720 Active

So I have to paste it in a text editor to select and copy the relevant part of the error message

4 Tabs won't last in copied code

I often copy some earlier written code to use and modify elsewhere. I comment this code with a couple of tabs and //. After copying, all tabs are replaced with spaces (regardless the setting that I want tabs to comment). It takes a lot of extra time to replace the spaces again with tabs

5 Intellisense and used variables

What saves me a lot of time in VO is that after entering a variable and using it a few lines further (even in a comment) I can auto- complete that variable. In VS I have to retype it completely (except of course when it's a class variable)

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

Some other Visual Studio things I consider...suboptimal

Post by ic2 »

The message was seen 59 times and no reaction, so I can safely assume that this first handful of VS shortcomings I wrote (just a couple of things which work well in VO) are indeed VS shortcomings and not caused by incorrect use or settings.

I can skip the other ones :unsure:

Dick
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Some other Visual Studio things I consider...suboptimal

Post by Chris »

Hi Dick,

Well, I guess there are not too many people wanting to devote their time on defending VS :)

I agree about some of those matters you mentioned (and I can easily list a few more myself :)), but at least for (4), I am not seeing this. Maybe it's your settings (use tabs instead of spaces enabled/disabled) that makes you think you have tabs while you have actually inserted spaces?

Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Some other Visual Studio things I consider...suboptimal

Post by Phil Hepburn »

Dick, Chris, all,

The reason I did not respond is because the behaviour of VS for guys coding with X# is quite different in many ways to those coding in C# - same VS install. I know, I worked almost 100% in C# for a couple of years, towards the end on my time using Vulcan.

Since the integration of X# is down to the sterling work of Fabrice and Robert (I believe) there is no point at all me criticising when the two guys have other jobs as well ! - when Microsoft has a whole dedicated team, and who also is privy to all the internal documentation of how VS works with WPF etc., etc.. Our Team don't have this.

Now I have been working with X# for about a year or more full time (100%), I am not sure how C# behaves in the latest VS versions.

All I can say is that C# integration will be pretty darn good - BUT - one does need to learn how to drive it to get the best from it!

I try my best to improve integration for X# by reporting to Robert and Fabrice what I may find that does not seem right to me.

I am not going to be seen as criticising the X# Team when they are doing such a wonderfully good job.

For my HELP needs, I don't use context stuff but Help Viewer 2.2 is ALWAYS open on my desktop - get to know it and its brilliant. Been using it for years.

On the editor issues - you ARE aware that each editor can be set-up for editing in its own specific way - C#, X#, XAML etc.. And once spaces are inserted then that code copied won't I feel have its spaces changed / swapped over. have you enabled the free / white space, or whatever its called ?

I moved away from tabs as they cause issues with Help & Manual, and web published versions from it. And some other apps too gave issues with tabs.

Also one good tip I got years ago from Colin Newell and Paul Piko (both professional and heavy users of VS), was try to use the default settings that VS installs with, instead of a very personalised set-up. This way you can sit in front of many, any, most other, PCs and use VS straight off. So I gave up on ctrl+Y as my line removal (as was WordStar) and moved to using ctrl+L.

The same goes for everything else - just use it. I don't have issues as such, but then I do realise that you work in a different way to me. And, I was lucky enough to be able to move from VO completely to .NET over ten or more years ago.

I don't miss one bit NOT having to re-index my repository ;-0)

Good Luck,
Phil.
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Some other Visual Studio things I consider...suboptimal

Post by ic2 »

Hello Chris,

Nobody needs to defend VS. I just wondered if I missed a setting etc.

About 4) : I have tabs enabled. Apart from the fact that it's strange that you have to enable it (if I press a tab I want a tab, otherwise I'd type a couple of spaces anyway) the tabs in code convert to spaces when you copy and then paste them. I do use VS 2015 (because not all Vulcan projects are converted yet) but according to multiple posts in 'developercommunity'it is (still) not working. You have to vote for it, so it is quite surprising that it works for you.

https://developercommunity.visualstudio ... -repl.html

Dick
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Some other Visual Studio things I consider...suboptimal

Post by Chris »

Hi Dick,

Ah, right, I was pasting into another editor, so wasn't seeing this :)
Yes, I see what you say now, I think it's due to the way the VS editor handles spacing/indenting in the beginning of lines, I am not a fan myself of that either.

Btw, regarding the tabs/spaces option, even VO has that option :)

Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
Otto
Posts: 174
Joined: Wed Sep 30, 2015 6:22 pm

Some other Visual Studio things I consider...suboptimal

Post by Otto »

In the VO-IDE I set the setting 'replace tabs with spaces', because of the irritating way the cursor moves across the lines when scrolling down when there are tabs in the source. When scrolling (arrow keys) up and down, the cursor could slide from position x on the line to a totally unpredictable position left or right of it.
Ever had a collegae who had set his indenting to tab = 3 spaces wide? ever watched how neatly his code was in his editor and wondered why it was bogus in your editor with tab = 2 spaces?

I don't want tabs (or spaces for that matter), I want to navigate to the next tabstop to insert my code.

I'm not interested in whether there are spaces or tabs, but whether the code is readable. Whether viewing with NotePad++, XIDE, VS, Code, Notepad etc. And tabs just make it your code look like s##t.

And do you know what, I even don't want to navigate to the next tabstop to insert my code. I want my editor to format my code for me according to worldwide accepted standards, or some company specified set for that matter.
I start typing, deleting, inserting, correcting typing errors which made the compiler confused, etc and my editor tries to keep up with me. And when the code compiles and I think the editor has something mixed up in the formatting, I use one key combination, and voila, the code is neatly formatted, clean and slick. (Or rather as clean and slick as my code permits it :D)
The auto-indentation option (in combination with Resharper) is great for C#, was not workable in VO-IDE in my oppinion.

New mandatory or advised source code formatting, e.g. want 2 spaces instead of 4 when indenting? Adjust the setting, open the source file(s), one key combination and all is fixed.
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Some other Visual Studio things I consider...suboptimal

Post by ic2 »

Hello Otto,

I am not sure I follow you. With tab stops set to 3 and Uses spaces for tabs to No, I can read all my comments on the same position throughout a whole method. Now suppose I need to move my comments a few tabs to the right because of some longer code line added later. Or to the left because of removing that longer code line. In VO I can do that quickly (nearly without looking) , cursor down and tab or delete tabs. In VS I always have to look what happens per line because the pasted lines are space filled (meaning I first have to remove all the spaces and then insert tabs, which latst until the next time I copy the code somewhere). So what I don't follow how you get nicely lined out code in any other way.
because of the irritating way the cursor moves across the lines when scrolling down when there are tabs in the source.
Never noticed that but you are right. Maybe it's partly because you use spaces? Throughout a long method I see small movements using cursor down while cursor up it suddenly jumps more to the right, to a comment line and then more or less stays that way. But the same happens in VS. Normally it jumps to the left margin for empty lines, to the left parenthesis in methods and functions and to some random place in the code for the rest.
The auto-indentation option (in combination with Resharper) is great for C#, was not workable in VO-IDE in my opinion.
Again I think it's your use of spaces. Auto indent in VO works perfectly. In VS it looks like it currently works as well (Edit/Advanced/Format) but I earlier stopped using it - until today- because it failed sometimes in earlier versions. It may have worked good with Resharper earlier.

Dick
User avatar
Otto
Posts: 174
Joined: Wed Sep 30, 2015 6:22 pm

Some other Visual Studio things I consider...suboptimal

Post by Otto »

Even in code that contains only tabs, navigate through the source with your cursor at e.g. at the end of an multiline IF statement, especially if it is nested. The cursor moves seemingly random across the lines.

I just tried the CTRL-ALT-I in VO and it works not for e.g. multiline IF conditions.
If the flow is simple, it does work fine I have to admit.

I don't know whether and how it works for XSharp: I work with XSharp at the moment only with legacy code and don't have to change much at the moment other than delete parts and do some simple changes.
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Some other Visual Studio things I consider...suboptimal

Post by ic2 »

Hello Otto,
Otto Christiaanse wrote: I just tried the CTRL-ALT-I in VO and it works not for e.g. multiline IF conditions.
If the flow is simple, it does work fine I have to admit.
It's absolutely amazing that you write it doesn't work. Are you sure you are not using VO 1.0c ;) ? When somehow I've added and moved quite some code, e.g. with such multiple nested IF-ELSEIF-ENDIF's, and the indentation has become a bit of a mess, I sometimes select the whole prg (one of the things you can do so nicely in VO), press Shift TAB a few times until all code is in the left margin and choose indent. I then add one extra tab for the whole code (I line out the variable declarations against the margin, so the code indents 1 tab more than Ctrl Alt I does for me). Every time all looks 100% correct.

Dick
Post Reply