Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

VIsual Studio Question - Braces but no Semicolon autocomplete?

Discussion in 'Scripting' started by outtoplay, May 21, 2015.

  1. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    I usually work on a mac, but installed Visual Studio Community 2013 to bone up on my C3 skills. After getting oriented the first thing I noticed was Braces auto-complete, but apparently no such joy for semicolons at the end of lines. It's seems there used to be a keycombo in previous releases, but doesn't work in 2013. Can say a lot of things about Monodevelop, but getting those braces & semicolons was mighty handy.

    Is there a handy way to do this that I've not discovered yet?

    Thanks,
    B.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,744
    This question would probably be better served in the External Tools subforum.
     
  3. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Seemed pretty 'scriptish' to me, but no worries.
     
  4. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    What boggels my mind is, the vast majority of my lines of code don't take up more than one line. I think Visual Basic had it right here...if you want to have multiline statements, split them with a special characther, otherwise just hit enter.

    I wish C# would allow this behavior. I'm tired unnecessary semicolons.
     
  5. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Auto closing braces annoy the crap outta me!

    auto semicolons would be worse.
     
    LeftyRighty, lordofduct and RockoDyne like this.
  6. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    so no semicolons? In mono, say you're typing Debug.Log("blah") by the time I type the 'h' in blah, if I type ';' and hit return it intelligently put the semicolon at the end of the line, even when you type it within the ()s... This behavior I like.
     
    Prosto_Lyubo likes this.
  7. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,380
    Totally agree!

    It's because C# takes inspiration from Java and C++ (hence the name), which takes inspiration from C, which took inspiration from B... B took inspiration from BCPL, and is the language that brought in the semi-colons, which honestly if you look at B compare to BCPL, the semi-colons actually made things more readable. Consider a time when writing code on a screen not measured in pixels, but in letters... a line end could easily be 3 lines on screen.

    The semi-colon has been kept around... mostly out of tradition. It just doesn't feel like C with out it... all my BASIC programmer buddies even refer to C-like languages "curly code" in reference the curly brackets and wiggly semi-colons.

    If you're tired of unnecessary semicolons, go code in a language that doesn't have them. VB, python, ruby, even boo (which kind of sort of is still supported in unity 4... but not really) are all semi-colonless languages.

    MonoDevelop exists for Windows, OSX, and Linux.

    Not sure why you need VS2013 to bone up on C# (I'm assuming you meant C# when you typed C3).

    Personally I like my auto-complete to be optional. I type, the member name appears, but it doesn't get placed in unless I hit tab. This I like.

    To often in MonoDevelop I'm fighting with the auto-complete to NOT put things in.

    VS2013 actually introduced various keyword auto-complete, when you write linq in parens for instance... it drives me nuts!

    For instance I'll want to write something like this:

    Code (csharp):
    1.  
    2. var arr = (from o in someColl where ... select o).ToArray();
    3.  
    But once I get to 'from' and press space, it turns 'from' into something like:

    Code (csharp):
    1.  
    2. var arr = (DefaultFromSelfAttribute...
    3.  
    All because I happen to have a type with the word 'from' in it, and the paren makes the auto-complete THINK I'm talking about that type, rather than the linq statement, even though the type starts with Default, and I typed FROM.
     
    Last edited: May 22, 2015
  8. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Riddle - How is a forum thread like a family holiday? Folk offer their thoughts on one's question, but not an actual answer. It's like Thanksgiving dinner at my house. ;)
     
  9. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    by default no (for reasons above) but I'm sure there are going to be extensions that would help...
     
  10. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    This drives me crazy as well. It'll do it in lamda expressions too - even for variables that are already declared.
     
  11. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    @LeftyRighty Thanks, simple enough.
    @lordofduct Appreciate the info. Since I've heard such good things about VS, figured if I was going to concentrate on just C#, I'd give it a go. Mono will work for now.
     
  12. David-Hernan

    David-Hernan

    Joined:
    Sep 19, 2014
    Posts:
    2
    Shift + Enter

    I am using Visual Studio Community 2015.
    At any column in a line, press Shift + Enter, a semicolon and a return will be added ad the end of the line.
    In some cases, if the statement is not valid, only a return will be added.
     
  13. dani-unity-dev

    dani-unity-dev

    Joined:
    Feb 22, 2015
    Posts:
    174
    Nice, never heard of it. But isn't it actually easier to just type the semicolon?
     
  14. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,380
    Not if you're not at the end of the line...

    but then of course... still really rare.

    I've been using Visual Studio for a very long time and have never used that.
     
  15. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,199
    We've got boo code running in Unity 5 with no problem. And not just Monobehaviours in boo, but dark magic macro-based boo.

    Language is dead as hell, though (main maintainer's just gone), but it works in Unity. Since it's a .NET language, it should always be possible to make work, but Unity 5 still comes with the compiler built-in.
     
  16. dani-unity-dev

    dani-unity-dev

    Joined:
    Feb 22, 2015
    Posts:
    174
    Same here but your are right about the fact that it could be of some use if you are not at the end of a line.
     
  17. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,380
    That's an old post, before I had unity 5.

    But in it I was referring to support, in the unity offers support for it, sense. Like documentation and the various things that come with 'supporting a product'.
     
  18. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,199
    This forum is less a Unity forum and more a necromancer club.
     
    lordofduct and KelsoMRK like this.