Search Unity

Monodevelop code highlight and autocomplete

Discussion in 'Scripting' started by Eyeofgod, Oct 16, 2010.

  1. Eyeofgod

    Eyeofgod

    Joined:
    Jun 25, 2010
    Posts:
    126
    Hi there,

    I have started to use Monodevelop instead of Unitron to test the new features. The problem is that syntax highlight and code autocompletation doesn't work well. Here is an example of the problem with the hghlight:

    if i write:
    Code (csharp):
    1. Input.GetAxis("Horizontal")
    only "Input" and "Horizontal" are highlighted. Another example:
    Code (csharp):
    1. transfom.position.x
    No word is highlighted.
    With the autocompletation the problem is that it only has some words, for example it recognize "Transform" but not "transform", and all the time it converts you writing making coding a pain.

    Any clue how to solve this?

    Thx!

    Cesar
     
  2. Chris-Sinclair

    Chris-Sinclair

    Joined:
    Jun 14, 2010
    Posts:
    1,326
    I've never had autocomplete issues like this with Visual Studio, maybe try that? (if you're using C#, if you're using UnityScript/Boo I don't think it will won't work.)

    However, I do imagine that in either IDE "GetAxis" would not be highlighted. Typically members of objects (methods, fields, etc.) are not automatically highlighted. There may be options or plugins you can use to change that highlight, but I'm not sure.
     
  3. Vicenti

    Vicenti

    Joined:
    Feb 10, 2010
    Posts:
    664
    Use UnityDevelop (available on these forums) for Unityscript; it has very nice autocomplete functionality.
     
  4. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    Hello,

    I hope that you don't mind that I post my auto complete question here too :).

    With following java script example the local variable weapon01 will not Intellisense:

    Code (csharp):
    1.  
    2.  
    3. function Update () {
    4.    
    5.     if (Input.GetButtonDown("Fire1"))
    6.     {
    7.         //create the prefab
    8.         var weapon01 : GameObject = Instantiate(weapon01Prefab, transform.position, Quaternion.identity);
    9.        
    10.        
    11.         //add force to the prefab
    12.         weapon01.rigidbody.AddForce(transform.forward * 1000);
    13.     }
    14.    
    15. }
    16.  
    I don't have this behaivor with my C# scripts. It can really get annoying if my local variable starts with a word that makes part of a larger word in the auto completion list. For example:

    hit will be automatically auto completed to WheelHit because I press space bar after typing hit! The escape from this is every time hit the escape button before pressing the space bar. In my opinion it should not auto complete if there is no exact match. Can this behaivor somewhere tweaked?


    A solution to this problem is match appreciated. :cool:


    Peter.
     
  5. Eyeofgod

    Eyeofgod

    Joined:
    Jun 25, 2010
    Posts:
    126
    Im using UnityScript and Mac, so VisualStudio is not an option to me (sadly)

    When using Unitron all Unity classes are highlighted, Input.GetAxis as an example is fully highlighted. I well give a try to UnityDevelop to show it that helps.

    Thanks all
     
  6. Hyphen

    Hyphen

    Joined:
    Sep 7, 2010
    Posts:
    5
    It's not a full solution, but this makes life A LOT better:

    Go to Preferences -> Text Editor -> General -> uncheck "Commit completion list selection with space or punctuation"

    Now you will have to press enter to get auto complete.. instead of having to press escape to not get it.
     
  7. Philbywhizz

    Philbywhizz

    Joined:
    Nov 20, 2009
    Posts:
    15
    Awesome!!! - Thanks for that.. it has made a big difference.
     
  8. Eyeofgod

    Eyeofgod

    Joined:
    Jun 25, 2010
    Posts:
    126
    Sorry for reopen this thread but i have noticed that the new monodevelop version solves some problems. The "Transform/transform" problem is solved, but the syntax highlight problem is still there. Any clues to solve it? (Im using UnityScript and Mac)
     
  9. Charles-Van-Norman

    Charles-Van-Norman

    Joined:
    Aug 10, 2010
    Posts:
    86
    I am having the same issue.... using MonoDevelop 2.4.1 there is no Unity syntax highlighting.
     
  10. a_unity_user057

    a_unity_user057

    Joined:
    Jan 4, 2011
    Posts:
    16
    Yes, I noticed this right away in the latest version of Unity, currently 3.1.

    The funny thing is that MonoDevelop comes pre-installed along with Unity, yet.. it doesn't even pick up syntax/code highlighting, nor does it pick up auto-complete.

    I smell "unfinished product" all over the place here. Anyways, I just went from UniScite, which is the default editor for Windows Unity, to trying to upgrade to MonoDevelop for more versatile programming IDE, to going back to UniScite.

    Also, UniSciTE's default coloring scheme for syntax highlighting needs a total re-do. What's up with reserved keywords turning black to extremely dark blue? I have to literally put my face 1" from the monitor to see if the code highlighting even took place.
     
    Last edited: Jan 7, 2011
  11. burtonposey

    burtonposey

    Joined:
    Sep 8, 2009
    Posts:
    62

    What's really odd is this works on my machine (Mac Snow Leopard). I have 2.4 (not sure if it's 2.4.1 it does not say that explicitly). I was able to simply post this into an existing code file, didn't have to hit save or anything, and started type "we" and weapon01 was there to choose.
     
  12. Tharaxis

    Tharaxis

    Joined:
    Feb 6, 2011
    Posts:
    1
    There seems to be an issue with the MonoDevelop version provided with Unity3D (could be Mac only, not sure).

    When Unity opens the file in MonoDevelop no intellisense exists, pressing the period (.) results in only file local class members and standard system assembly types being listed. Unity-specific types don't exist.

    However, closing the file and reopening it via the project window will then initialize intellisense correctly and all then works. This is however a HUGE hassle.

    I was looking through the MonoDevelop 2.4.1 changelog and there does appear to be a fix for opening files via the Finder on Mac, but since I haven't upgraded MonoDevelop past that provided by Unity I can't check whether this actually fixes that problem or not.
     
  13. Morgan

    Morgan

    Joined:
    May 21, 2006
    Posts:
    1,223
    I seem to have found an old thread, but rather than starting a new one: this is still a problem in the currently bundled MonoDevelop 4.0.1. There's a "Toggle Completion Suggestion Mode" option in the Edit menu that helps greatly, but is set to a bad default state (with no visual indication or checkmark) and doesn't affect the period key, only the spacebar.

    So for example, type this (with no leading zero)...

    var x : float = .2

    ....and you get "byte" added automatically, generating an error:

    var x : float = .byte2

    (I'm developing for iOS on Mac, so Visual Studio isn't an option.)