MonoDevelop secret tips :

Discussion in 'External Tools' started by n0mad, Sep 8, 2011.

  1. n0mad

    n0mad

    Member

    Joined:
    Jan 27, 2009
    Messages:
    3,731
    Hello,

    I just found a neat built-in feature inside MonoDevelop :

    Whenever you put the word "TODO" (case sensitive) in a comment, it highlights the word in a flashy color so that you can see it instantly when browsing your code.

    Can be very helpful to find an old Todo thing !

    Considering it's kind of cool, and totally unnecessary from MonoDevelop devs to implement that, I guess there are other built-in tricks like that.

    Do you know some ?
  2. ahmetDP_1

    ahmetDP_1

    New Member

    Joined:
    Sep 23, 2010
    Messages:
    113
    You know it also pops up in a list inside TaskList pad (View -> Pads -> TaskList)
  3. n0mad

    n0mad

    Member

    Joined:
    Jan 27, 2009
    Messages:
    3,731
    Brilliant ! Thanks :)
  4. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,178
    Ehe, probably by now you will have got them, but just in case:
    - FIXME is the same as TODO, but is highlighted in red.
    - In MonoDevelop "Tools > Options > Task List" you can add more tokens (special words) and set their importance.
  5. n0mad

    n0mad

    Member

    Joined:
    Jan 27, 2009
    Messages:
    3,731
    Didn't know the FIXME one, thanks :p
  6. Philipp_S

    Philipp_S

    New Member

    Joined:
    Jul 18, 2012
    Messages:
    13
  7. pjezek

    pjezek

    Member

    Joined:
    Jun 10, 2009
    Messages:
    14
    Thanks for that list, very helpfull :)
  8. EyecyArt

    EyecyArt

    Member

    Joined:
    Nov 22, 2010
    Messages:
    213
    Wow. I always write Todo┬┤s in my scripts and wished that something like that exists XD
    I use C# in Visual Studio but it works there too!
  9. MattRix

    MattRix

    Member

    Joined:
    Aug 23, 2011
    Messages:
    51
    The two uncommon commands that I use a LOT are:

    "Navigate to" - just start typing the name of ANY class or method name or variable name in your project, and it'll take you right there. Super handy, I use this constantly. Bind it to a shortcut that's easy for you to do with one hand (CTRL+Shift+R for me).

    "Dynamic Abbrev" - bound to Ctrl+/ for me. Type the first character or two of ANYTHING you could possibly want to write (ex. variable names, method names), it will fill in the rest, if it doesn't choose the right one, keep hitting the shortcut until it does. It goes in historical order of the most recent things you typed. It's like autocompletion but super fast because it's not doing any complex calculations, it's just looking through things that have been typed in the past (or something like that). Seriously this will save you from typing TONS of stuff, I use this more than any other shortcut.
  10. Matthew Scott

    Matthew Scott

    Member

    Joined:
    Jan 16, 2013
    Messages:
    27
    I like to do a lot of scripting in UnityScript but find that monodevelop sometimes isn't as intuitive when comparing to use in C#, NotePad ++ is actually pretty good for it though...
    Last edited: Dec 10, 2013
  11. EMOTION THEORY

    EMOTION THEORY

    Member

    Joined:
    Jul 16, 2013
    Messages:
    23
    Hey guys! I know this thread is kind of old now but I love the idea of sharing Tips and Tricks! Props to Philipp_S for writing up a blog post, I hope to do the same!

    Here's one of my favorites:

    Type 'for' and then push tab twice, and it'll make a for loop for you! Push tab to edit some of the fields if need be (it will try to auto-fill things as best as it can). Push Enter to set the cursor inside the loop so you can start typing your implementation. This works for 'foreach' as well. Very handy for quick coding.

    Anybody know what this is called and how we can customise them? Cause I find it fascinating :)

    Cheers all

    EDIT:

    They're called Code Templates. You can find them in MonoDevelop > Preferences ( CMD + , )

    $Screen Shot 2014-03-18 at 2.13.11 pm.png

    There are heaps! Using them could be a huge performance booster.
    Last edited: Mar 18, 2014
  12. Sisso

    Sisso

    Member

    Joined:
    Sep 29, 2009
    Messages:
    156
    Adding stuff.... Theses templates really help me.

    Template to create a custom inspector

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5.  
    6. [CustomEditor(typeof($component$))]
    7. [CanEditMultipleObjects]
    8. public class $component$Inspector : Editor {
    9.     public override void OnInspectorGUI() {
    10.         serializedObject.Update();
    11.         var obj = target as $component$;
    12.         DrawDefaultInspector();
    13.         serializedObject.ApplyModifiedProperties ();
    14.     }
    15. }
    Template to create a singleton

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class $c$ : MonoBehaviour {
    6.     private static $c$ ins;
    7.  
    8.     public static $c$ Get() {
    9.         if (ins == null) {
    10.             ins = GameObject.FindObjectOfType<$c$>();
    11.             if (ins == null) {
    12.                 var obj = new GameObject("$c$");
    13.                 ins = obj.AddComponent<$c$>();
    14.             }
    15.         }
    16.  
    17.         return ins;
    18.     }
    19. }
    Question:

    There is any shortcut to navigate inside the file? For example, go to method Awake in current class? Something like eclipse IDE is ctrl+o.
  13. Flipbookee

    Flipbookee

    Member

    Joined:
    Jun 2, 2012
    Messages:
    704
    In MonoDevelop 4 press 'Ctrl+,' and you can search for anything (types, members, commands, and even files) by name or only part of the name! This is the most useful thing I've found so far in MD and one of the rare things that actually work and it's fast.
  14. Sisso

    Sisso

    Member

    Joined:
    Sep 29, 2009
    Messages:
    156
    I didn't see utility for method search, try to search for "Awake", Will show Awake from a lot of classes, but not the open one.
  15. Flipbookee

    Flipbookee

    Member

    Joined:
    Jun 2, 2012
    Messages:
    704
    Might be easier to just use the code navigation bar:
    $NavBarMD.png