Visual Studio...



  • I've been meaning to learn C# after putting it off for years. I'm quite fluent in Java, which means I should be able to pick it up rather easily. I've been having no issues with the language and I often find it better than Java for a lot of things (not so for others, but that's why it's called C# and not Better Java). But I just stumbled into... quite something in terms of the IDE.

    I'm not a Java IDE apologist by any means. I'm forced to use NetBeans for work, which I find not really optimal and has a lot of weird quirks. It's not bad by any means, just as Eclipse isn't really that bad and has its own set of quirks. I very much prefer Eclipse to do Java development, but NetBeans is okay anyways.

    But I've been digging into Visual Studio (specifically 2013 Community Edition) and boy, for all the convenient stuff it has in terms of templates for project generation, I'm amazed it doesn't pack such a basic feature as a hotkey for expanding the suggestion tool and complete a menial task such as importing a class.

    I googled a bit on the matter just to prove I'm not the WTF here, and I was pointed to ReSharper, which is a plugin that costs TWO HUNDRED AND FIFTY US DOLLARS. What?!

    Please tell me I'm TRWTF because I'm having trouble understanding how people work with this IDE day to day without a feature like that. It would drive me absolutely insane if I had to reach for the mouse whenever I want the linter to stop throwing up errors and tell the IDE that yes, I do want to import that class that is very much within my project, and yes, I do want to import that standard library, thank you very much.

    I know this sounds like a rant but it's not really that bad, I just find it amazing because Visual Studio in and of itself is a pretty impressive tool. The fact that it lacks such a basic feature seems incredible.



  • @dstopia said:

    such a basic feature as a hotkey for expanding suggest

    I don't know what that means...

    You mean inserting an auto-complete suggestion? You can tab to it and hit enter.

    @dstopia said:

    and complete a menial task such as importing a class.

    Right-click the class and pick "Resolve" from the contextual menu. I assume there's a keyboard shortcut for this, but it's not something I do often enough to really care to memorize.

    @dstopia said:

    I googled a bit on the matter just to prove I'm not the WTF here, and I was pointed to ReSharper, which is a plugin that costs TWO HUNDRED AND FIFTY US DOLLARS. What?!

    ReSharper is stupid trash.

    @dstopia said:

    I'm having trouble understanding how people work with this IDE day to day without a feature like that.

    Like what?

    Even if you just want to hit the contextual menu, you can do that from the keyboard just like any other contextual menu. Hit your context menu key, then "s" activates Resolve.

    I saw a post on Stack Overflow that says control-period does it, I dunno.

    Personally the whole idea of references is stupid IMO. Visual Studio knows which ones it needs, it should just fucking DO it. So I kind of agree with you.



  • @blakeyrat said:

    You mean inserting an auto-complete suggestion? You can tab to it and hit enter.

    Not quite, I mean when you declare an instance of a new class you just created and the IDE can't get the reference because it's in another namespace.

    @blakeyrat said:

    I saw a post on Stack Overflow that says control-period does it, I dunno.

    I saw the same post, Control-period does nothing to me. On NetBeans and Eclipse I should be able to do Control-Space, bring up the context menu and select the option I want with arrow keys + space (I think that's the hotkey for Eclipse, haven't used it in a while...). I do it all the time in my day to day development.



  • Well, again, it's in the contextual menu, and you can do all those functions from the keyboard, so I don't see how that's any worse than NetBeans. Except Windows has a single key for bringing up the contextual menu and you don't need to use control-space.



  • Hmm, maybe I'm not getting my point across. Here's what I see:

    State is a class in another namespace within my project (though that doesn't really matter, Eclipse and NetBeans attempt to resolve the name you typed to all the libraries your project links to). On Eclipse and NetBeans, I should be able to import the class by pressing Ctrl+Space, which brings up the equivalent to this menu:

    which allows me to autogenerate the import. I haven't found a way to automatically access this menu from a hotkey in VS at all.

    Keep in mind that Ctrl+Space works in both Netbeans and Eclipse from any point of the line no matter the state the line of code is in, in general.

    I know it's a silly complaint, but it's pissed me off a little while trying C# out and what I'm truly wondering is if what I'm doing is completely wrong.



  • Addendum, it seems like Ctrl+period works, but ONLY if the caret is on the class (which brings up the smallish blue underline).

    I don't know if my complaint is truly warranted, but I found it easier in Java IDEs, I guess. Disregard, I suck cocks etc.



  • Sigh.

    Do you have a key on your keyboard that looks like this:

    Pressing that key will bring up the contextual menu, as if you had right-clicked where the insertion point is.

    Once the contextual menu is open, you can either use its shortcuts, or navigate around it with the arrow keys, just like you did in NetBeans.

    This is a standard feature of the OS you're using and has been for, what, 20 solid years now. FYI.

    @dstopia said:

    I don't know if my complaint is truly warranted, but I found it easier in Java IDEs,

    The feature you're using to do this in Java IDEs is, as far as I can tell, a complete rip-off of that standard 20-year-old Windows feature. Except it requires a chord to activate.

    In any case, if you go back to that StackOverflow post, it has the name of the "action". Knowing that, you can set up whatever keyboard shortcut you want. Knock yourself out.



  • Put the cursor in the object class name that defines the variable and press Control + .. If the class is defined in the resources, press enter to do the using insert. Works fine for me in VS2013.

    e.g.: for

    Class instance = new Class();
    

    put the cursor in the first Class token.



  • @dstopia said:

    State is a class in another namespace within my project (though that doesn't really matter, Eclipse and NetBeans attempt to resolve the name you typed to all the libraries your project links to).

    Visual Studio Intellisense mostly works the same way the compiler works. If the compiler can't see that class, neither can Intellisense. Did you include the other namespace with a using statement?



  • @NedFodder said:

    Did you include the other namespace with a using statement?

    Unless I'm the WTF here, the exact feature he's talking about is the one that automatically inserts using statements as-needed.

    And, again, VS is smart enough to know exactly what using statements you need. The compiler's smart enough to only actually build the ones you actually use. It's just too dumb to JUST FUCKING DO IT without bothering you. Very annoying.



  • @blakeyrat said:

    Unless I'm the WTF here, the exact feature he's talking about is the one that automatically inserts using statements as-needed.

    And, again, VS is smart enough to know exactly what using statements you need. The compiler's smart enough to only actually build the ones you actually use. It's just too dumb to JUST FUCKING DO IT without bothering you. Very annoying.

    Actually VS is only smart enough TO A DEGREE. If you suddenly need a Point class and two of the system library namespaces just so happen to have one, and it just happens both derive from a parent class thats the actual argument type for a method. Good luck.



  • When it can't tell the difference, THAT'S when it asks.

    Until then, it should just FUCKING DO EEEET.

    Honestly the language should do away with standard using statements anyway, unless (as pointed out) there are conflicting class names. Make them all optional. Why the fuck not? The IDE gets it, the compiler gets it. Why waste our time?



  • @blakeyrat said:

    When it can't tell the difference, THAT'S when it asks.

    Until then, it should just FUCKING DO EEEET.

    Then you upgrade to .NET 5 and suddenly it doesn't work and people bitch and whine because Microsoft reused a class name. Explicitly is there for a reason. Why even bother having namespaces at that point otherwise.



  • Oh come on. If you upgrade the project and now there's a new naming conflict THE IDE IS SMART ENOUGH TO FIGURE THAT OUT AND PROMPT. Goddamned, I'm a fucking idiot, and I could write that fucking code.

    "Deeeeerp we shouldn't do this really easy and obvious usability improvement because what if we suddenly become retarded retards during the next version and make it all broken-like deeeerp!!!"



  • @blakeyrat said:

    Unless I'm the WTF here, the exact feature he's talking about is the one that automatically inserts using statements as-needed.

    I've seriously never heard of that feature. I'm always doing crap like typing File.Ope - WHY THE CRAP WON'T THE IDE AUTOCOMPL - oh, I forgot to say using System.IO;.



  • Don't ask for opinions here. Download vs 2013 pro or ultimate trial, use it for a few days then install resharper. Try it for a week, uninstalled reshaper and try vs for a few more days. Decide what you like.



  • Just don't blame Visual Studio for bloaty-crashiness while ReSharper is installed, because ReSharper is a bloated, crashy bitch.



  • Does ReSharper emulate Linux hardw--

    [gunshot noise]

    [slumps over in chair]


  • Winner of the 2016 Presidential Election

    I don't even understand Blakey's hatred for it. It really helps. A lot.

    Granted this is coming from an IntelliJ user, so maybe I just like the JetBrains IDE stuff. IntelliJ is pure awesome though.

    ps.ss tab 1, us tab ); ---> preparedStatement.setString(1, username);

    Or

    ul tab .for tab ---> for(User user : userList){ }

    And inb4 usability rant: this all pops up in a nice little discoverable autocomplete thingy. You don't have to type it all by memory...


  • mod

    @NedFodder said:

    I've seriously never heard of that feature. I'm always doing crap like typing File.Ope - WHY THE CRAP WON'T THE IDE AUTOCOMPL - oh, I forgot to say using System.IO;.

    I use it all the time. Saves having to remember the entire class and namespace structure of .NET.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.