May 29, 2005

Code Completion Illustrated, Part I : Basic Completion

Time to time I find our that some users don't know about half of the features ReSharper code completion provides (that's what some call IntelliSense - the popup which suggests you what you probably would like to type here) and I really suffer it because so much code was written for all those little handy things and people don't know about them. So I decided to write several entries to my blog explaining how ReSharper completion works and why. The series will consist of four parts - one for each type of completion (Basic, SmartType and TypeName) plus one describing insert/replace modes. Here's the first part describing Basic completion.
Basic completion is what you probably use most of the time - it is usually invoked with Ctrl+Space shortcut (Ctrl+J and F4 seem to work in pure VS.NET) and lists symbols available in the context:


It is pretty similar to what you get in VS.NET except several differences: blue highlighting for typed prefix, editor-styled font, green and red markers for properties showing if they're readable or writeable, bold fonts for members implemented to the type itself, etc. If you don't like our looks (icons and fonts) there's option to switch to Visual Studio ones.
Basic completion also automatically pops up if you press dot:


where it lists available members. Not that by default it merges method overloads to single list entry. If you don't like it you can switch an option et voila:


- you've got all signatures plus return types.
Really important differences come up when you choose an item - it not barely inserts its name, but, if needed, it adds parentheses, semicolon and places caret to the right place:


The last thing I would like to tell you about is name completion: once you press Ctrl+Space where a new name in declaration is expected, ReSharper comes up with names based on type name and your prefix preferences:




You can also add custom prefix for those names by typing it prior to calling code completion:


Naming conventions (prefixes and suffixes for different kind of symbols) can be configured (you see that we have pretty unusual prefixes for instance and static fields).

That's all for today - next entry will feature insert and replace modes in code completion. Hope this entry will make you more productive with ReSharper from this moment on.

Posted by Oleg Stepanov at May 29, 2005 07:25 PM | TrackBack
Post a comment

Remember personal info?