Search code examples
unity-game-engineautocompletemonodevelop

MonoDevelop: How to auto complete parameters when typing Method name


I'm trying to increase my speed of typing code in a Unity project, and finding a big hole in MonoDevelop.

If I have a method like:

void Foo(float x, float y, float, z) {
    //
}

When I start typing

Fo

I want it to autofill with:

Foo(x,y,z) 

with the x, y, and z, highlighted green.

Currently, it only autofills with

Foo

I would like functionality like what happens when you type for and hit tab twice, where it autofills:

for(int i = 0; i < max; i++) {

}

with max highlighted in green.

I feel like there should be a built in way to do this, but I can't find anything here or on the web. I know for Java in eclipse it has similar functionality to what I want here.

EDIT: Based on a more refined search from the answer below, I was able to confirm that it doesn't seem like you can do this in MonoDevelop. However, this search revealed that Microsoft just released Visual Studio for Mac, which runs super nicely with Unity and has much better code completion features compared to monodevelop. It still doesn't fill in the parameters, but it at least gives you a little popup window guiding you through which ones you need and what type they are. A huge improvement to say the least. After playing around with it for literally 5 minutes, I'm already prepared to scrap MonoDevelop entirely. The nice thing is the interface is basically identical, just seems like a much more polished and modern version.


Solution

  • for+tab+tab is a Code Snippet that has a whole syntax devoted to typing short things and getting long ones. The for syntax is generally unchanged throughout and so it's easy to write a snippet to cover the general use-case.

    Methods are not typically in this category of autocompletion, as the number, type, and name of the paramters will change depending on what method is being completed, and so behavior varies by IDE. Eclipse does the best job I've ever seen, even going so far as to make an educated guess as to which variables available in the current scope would be appropriate as parameters! Its not always right (eg. I've gotten something like Translate(xpos, xpos, xpos) before, when Translate(_x, _y, _z) would have been better).

    How, and if, you can get Monodevelop to autocomplete method parameters will likely revolve around these snippets. I don't use MD myself so you'll have to dig into the documentation on making your own snippets, but I suspect it won't be possible (based on my own experience reading the snippets docs for Visual Studio).