Is there anyway to disable Visual Studio auto complete for object keyword
Solution 1
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 "{".
Solution 2
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.
Solution 3
To turn IntelliSense options OFF by default
On the Tools menu, click Options.
Select the Text Editor folder.
Select the folder for the language you want to customize IntelliSense.
In the General property page, clear check boxes for IntelliSense features that you do not want:
Auto list members applies to List Members
Parameter information applies to Parameter Info
Comments
-
RichardOD almost 2 years
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 tonew 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.
-
RichardOD almost 15 yearsPressing escape is my current solution to the problem- thanks for the suggestion though- it might be useful to others reading about this.
-
D'Arcy Rittich almost 15 yearsI actually tried removing "{" as suggested above, restarted Visual Studio, and it still added "object" when I typed "{".
-
John Fisher almost 15 yearsOrbMan, when I ran the test, I removed both "{" and "}". Does that work for you? (It did for me.)
-
ShadowScripter about 14 yearsI have one similar to that for JavaScript for creating anonymous functions, func-TAB create function(){$END$}