dcsimg
Results 1 to 14 of 14

Thread: Automatic parenthesis

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,450

    Automatic parenthesis

    I just installed VS 2015 Community. I've noticed that when coding, that MessageBox.Show "some info" does not automatically enclose the text in parenthesis, like my VS 2010 Pro version does. It's a small thing but is there an option I can set to make this happen. I'm not talking about "Autocomplete Braces", it does that.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,741

    Re: Automatic parenthesis

    Unless you've just switched from VB6, I can't see any reason that you'd need such an option. To each their own it never even occurs to me to not type a parenthesis. In fact, I would never even have to type one because I'd always use Intellisense to complete the Show method and that would automatically add the parentheses. I take it that you don't do the same.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,450

    Re: Automatic parenthesis

    jmc,
    No, I've been using .Net 2010 since 2010. I do use intellisense, once "Show" is highlighted, I press the space bar, type "something" and hit enter. The parenthesis are then added automatically in VS 2010. It's not that it's hard to type a parenthesis, it's just a habit, I've been doing for years. If VS 2015 is not capable of doing that then I'll change but if there is an option I can set so it does add the parenthesis for me, then that is what I want to do. As you said, To each their own.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,741

    Re: Automatic parenthesis

    I tend to hit Tab where you said you hit Enter and it adds the parentheses then. In which case you wouldn't need them to be added later. I would have thought it would do the same with Enter but can't test that right now. I also use ReSharper so I'm often not sure what VS is doing and what is ReSharper.

  5. #5
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,191

    Re: Automatic parenthesis

    Quote Originally Posted by wes4dbt View Post
    jmc,
    No, I've been using .Net 2010 since 2010. I do use intellisense, once "Show" is highlighted, I press the space bar, type "something" and hit enter. The parenthesis are then added automatically in VS 2010.
    Does the same in 2013 (with a caveat) if I followed what you said. Typing MessageBox.Show "something<Enter> will add the parenthesis but also puts a " at the start of the following line because it automatically adds an end quote mark when you type the first one. If you hit End or arrow a character over before hitting <Enter> then it wouldn't do that.

  6. #6
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,252

    Re: Automatic parenthesis

    Quote Originally Posted by wes4dbt View Post
    I've been using .Net 2010 since 2010. I do use intellisense, once "Show" is highlighted, I press the space bar, type "something" and hit enter. The parenthesis are then added automatically in VS 2010. It's not that it's hard to type a parenthesis, it's just a habit, I've been doing for years. If VS 2015 is not capable of doing that then I'll change but if there is an option I can set so it does add the parenthesis for me, then that is what I want to do. As you said, To each their own.
    I don't know of any option to re-enable that behavior , and even if there was I would expect it to be enabled by default. The inconsistency between versions sucks!

    I suppose you could create some code snippets to get around some of that, and using snippets may even make things easier in the long run in both 2010 and 2015. A couple of my quick attempts for messagebox posted here.

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,918

    Re: Automatic parenthesis

    I haven't seen this specific thing, because I always hit the open parenthesis. That's MY version of the habit. What annoys the heck out of me with VS2015 is that the intellisense is broken, at least on Messagebox. When you hit the comma, it should show you the NEXT argument needed, but instead it now shows the LAST argument. That's not very helpful.
    My usual boring signature: Nothing

  8. #8
    Addicted Member NinjaNic's Avatar
    Join Date
    Dec 2013
    Location
    Earth
    Posts
    230

    Re: Automatic parenthesis

    I do use intellisense, once "Show" is highlighted, I press the space bar, type "something" and hit enter. The parenthesis are then added automatically in VS 2010.
    You're not crazy, I remember this too. It's a small thing, but you notice it when it's not there.

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,450

    Re: Automatic parenthesis

    Quote Originally Posted by Shaggy Hiker View Post
    I haven't seen this specific thing, because I always hit the open parenthesis. That's MY version of the habit. What annoys the heck out of me with VS2015 is that the intellisense is broken, at least on Messagebox. When you hit the comma, it should show you the NEXT argument needed, but instead it now shows the LAST argument. That's not very helpful.
    I noticed something was wrong but thought maybe it was some kind of new feature.

    Thanks for all the replies, guess I'll have to work on breaking that old habit.

  10. #10
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,918

    Re: Automatic parenthesis

    Frankly, I'm optimistic about VS2017. The thing about VS2015 is that it was a total rewrite of some parts. Therefore, it was kind of the 1.0 version, which often tends to have issues. Various patches have made it better, but there are features in VS2017 that are looking much better still.
    My usual boring signature: Nothing

  11. #11
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,252

    Re: Automatic parenthesis

    Quote Originally Posted by wes4dbt View Post
    Thanks for all the replies, guess I'll have to work on breaking that old habit.
    fwiw, I just installed VS 2017 RC (.Net Desktop) and there seems to be no noticeable difference with how intelliSense works compared to 2015, so get used to it.


    Edit: Option Strict is still Off by default in 2017!

  12. #12
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,580

    Re: Automatic parenthesis

    I'm pretty sure you want "Automatic brace completion". That's normally oriented towards the curly brackets in C#, but I just toggled it a few times and it seems to apply to parenthesis. Tools>Options, then follow this:

    Name:  Screen Shot 2017-01-06 at 2.22.31 PM.jpg
Views: 265
Size:  25.5 KB

  13. #13
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,802

    Re: Automatic parenthesis

    That's the option that if you type "(" you get ")" automatically... that';s not what hte OP is looking for.,... what he says is if he types MessageBox.Show "test" and hits enter it changes to MessageBox.Show("test") automatically.
    I've seen that happen, but then I always hit the opening parens out of habit anyways, so..... shrug.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  14. #14
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Automatic parenthesis

    Quote Originally Posted by wes4dbt View Post
    ... guess I'll have to work on breaking that old habit.
    It is not just an issue of old habit. That auto parenthesis wrapping is very nice feature when prototyping Office Automation code in VBA to copy over to VB.Net code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width