Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anyway to disable Visual Studio auto complete for object keyword [duplicate]

Short version- is there a way to turn off Visual Studio Intellisense for the object keyword.

Long version- I'm using Visual Studio 2008 and I'm basically using anonymous types. I begin typing something like:

Assert.AreEqual("/SomePath/Stuff", GetOutboundUrl(

I type in new {

Then I see that Visual Studio has recognised that the method GetOutboundUrl takes an object and changed the code to new object{. Now must of the time this is great, except for two reasons:

1) I rarely have code that uses the type object.

2) I am actually trying to create an anonymous type not a object, so this feature is actually serving as a hindrance.

The signature for GetOutboundUrl is as follows (from the book Pro ASP.NET MVC framework if anyone is interested):

private string GetOutboundUrl(object routeValues)

I am wondering if there is a way to turn this feature off but only for the keyword object- I would like to see if I actually miss the autocomplete on object (personally I don't think that I will).

I realise that I can turn this off for all keywords by unchecking "Place keywords in completion lists", but I only want to turn it off for object.

like image 256
RichardOD Avatar asked Jun 20 '09 18:06

RichardOD


2 Answers

Without changing an actual Visual Studio setting (which I doubt exists), you could type "new ", then ESC, followed by "{". It's not ideal, but it keeps you from having to delete the word "object" each time.

You could address this particular situation by editing the options: "Text Editor" -> "C#" -> "IntelliSense" => "Committed by typing the following characters:". Remove the "{".

like image 93
John Fisher Avatar answered Nov 05 '22 20:11

John Fisher


I made a ReSharper Live template:

Shortcut: new

Contents: 
new { $END$ }

Now I can type n-e-w-TAB and I end up with "new { }" and my cursor between the curlies.

It's not ideal, but it's better.

like image 42
Lance Fisher Avatar answered Nov 05 '22 18:11

Lance Fisher