VS.NET 2015 Auto Complete / add brackets - visual-studio

Today I installed VS.NET 2015 and thought here are many good features, but I am having issues with several basic features I had in VS2013. I am not sure how I could bring them back.
A simple example, using VB.NET in VS 2015, I write
msg.ShowError "This is my error"
and when I hit enter, it auto adds brackets to it and make it look like this
msg.ShowError ("This is my error")
But now, it doesn't do that, and I have to manually add brackets.
Similarly, if I write something like
lblExported.Text = "This is
It doesn't close the quote automatically, as it was doing in VS2013 and before
lblExported.Text = "This is"
Any idea how to configure it to behave like old way?
I tried enabling
Tools->Options and from the dialog, Text Editor->All Languages->Automatic brace complete, but that didn't worked. Interesting part is that when I save and then re-open the dialog, this checkbox goes back into mixed state.
Thank you

Related

Visual Studio 2022 - How to turn off new AI red highlighting with arrow and tab replace feature - NOT intellisense entirely?

I've wasted almost an hour trying to find the setting to turn off the new AI autocomplete feature that was released in the last two months, between October 2022 and now.
I do NOT want to turn off intellisense entirely, only the new feature that highlights chunks in red and shows an arrow to replace the text with an auto suggestion.
This feature has not worked correctly since it was implemented for me. If you type fast, it's constantly trying to overwrite what you just typed, and it's constantly prompting for changes - even after hitting the escape key and rejecting them repeatedly.
Can someone please tell me the name of this specific feature, and how to disable it in VS2022?
Thank you.
I've spent an hour trying to find the release notes on this specific feature and have only found how to entirely disable intellisense, which is not what I want.
I still want the drop-down intellisense prompts as I'm typing, I do not want this red highlighting with the tab to replace arrow and suggestions that keeps popping up repeatedly after I've already written my code.
If you are attempting to write SQL strings in Visual Studio 17.4 and running into formatting issues with the red highlighting on intellicode, I recommend rolling back to 17.3.7 until a new update is available.
This dev community report has been acknowledged by Microsoft and hopefully a fix will be available soon as it's stamped pending release 1/17/23.
Still no word if this is baked directly into intellicode itself or is a separate feature.

VS 2012 Intellisense suggests treeChild instead of true

My intellisense almost always goes for "treeChild" when I start typing tr, instead of "true". It's a really small thing, but it's kinda annoying since I will sometimes accidentally press return and it puts treeChild into my bool.
Any ideas why this is or how to get rid of it?
I never even used treeChild. Or looked at it.
In VS 2012, IntelliSense can pre-select the members that you have recently selected in the pop-up List Members box for automatic object name completion, during your current session in the IDE. You can check this: IntelliSense for Most Recently Used Members
To turn off this default behavior, go to Tools-Options-Text Editor-C#-IntelliSense and uncheck the option “Pre-select most recently used member” as below, then click ‘OK’ to save this modification.

Stop VS 2010 from Auto Creating Braces After else keyword

I'm using VS 2010, and I'm getting constantly annoyed when I type "else" and then it auto returns line and adds braces. Something like:
else
{
}
I cannot imagine I'm the only one who often puts one-liners after the else and prefers no braces. How do I stop this from happening?
I also found this behavior very annoying.
My first attempt involved opening the Templates Explorer (ReSharper / Templates Explorer...), selecting C#, then unchecking "else". This did get rid of the braces. Unfortunately, hitting enter after "else" now just added a space! I was having to hit enter twice. Not quite what I was hoping for.
But if you double-click on the else template it opens up an editor where you can specify what happens. I found that simply removing the braces gave me the functionality I desired - hitting enter after an else was now putting me on a new line, tabbed over under the else - without braces.
To recap, to fix this you need to open Resharper's Templates Explorer, select the C# scope, then double-click on the else template and remove the braces. Your template "snippet" should look like this (just two lines):
else
$END$
This works in Resharper 6.1 and Visual Studio 2008. I have no idea about other versions of the software.
Okay, finally figured out what the hell is doing this. I have ReSharper installed on this machine, and apparently the "else" keyword is a ReSharper autocomplete keyword. So even after I turned off the braces completion, ReSharper was still kicking in and adding them. Rage. In order to stop this, you have to turn off the ReSharper autocomplete.
I don't think there's any way to disable brace auto-complete for specific keywords. If you go to:
Tools -> Options -> Text Editor -> C# -> Formatting
you'll find the various formatting options. It's possible to disable auto complete in general or affect indentation and such, but I don't see any way to disable brace auto complete for specific keywords.
Are you using Productivity Power Tools? You can turn it off in Tools, Options, "Productivity Power Tools", "Automatic Brace Completion". (I know I do)

Visual Studio Intellisense not work

I have one problem. When I press ctrl + space the Intellisense window will not show, but it works! I can chose any word by arrows press enter and then it one will appear, but the windows with this words not show. Some times it showed sometimes no. This problem occurs only when I am working with TFS project.
This is enabled
Tools->Options->Text Editor->C#->General->Auto list members
Tools->Options->Text Editor->C#->General->Parameter information
Tools->Options->Text Editor->C#->Intellisense->Show completion list after a character is typed
UPD
I have just committed changes, and the same problem occurred on colleges PC).
It's a bit old, but today, a colleague faced the same problem : intellisense did not work, neither than outlining.
He also had the line {GlobalSection(PowerDesigner) = preSolution HasSWS = 1 EndGlobalSection } in one of ours *.slns.
When he delete this line, intellisense work...better, but the outlining did work.
As it work pretty well on my computer, we found the only difference was a plugin : PowerDesigner from Sybase.
Without this plugin, intellisense and outlining work well again.
This was installed silently with another Sybase's product.

Visual Studio 2010 - Curly Braces auto-align has changed, how do I fix this?

Update: Since I see this is one of my most looked at questions, now a few years later I should point out what I found to be the most common cause of this problem: bad syntax elsewhere in your code. 100% of the time I've had this happen, it was because I'd forgotten a curly brace for another block of code, or I had a dangling if, or an earlier line of code I didn't finish. Check for IDE errors first for something like ") or } expected"
Original Question:
I feel like this is an all time dumb question to ask, but I have no idea how to fix this and google is turning up nothing.
In visual studio, when I type:
try {
}
VS would automatically reformat it to
try
{
}
But now it's just leaving it at the first one. I assume I accidentally hit a hotkey or something. Help me fix this please?
Tools->Options
Click Text Editor -> Whatever language -> Formatting
Tools->Options->Text Editor->C# (or whatever language)->Formatting->New Lines
Select the options you want.
If you have Power Commands installed you can then go to the Tools->Options->Power Commands and make sure "Format Document on Save" is selected.
Whenever you save the edited file the Curly Braces will be auto aligned.
In addition to the default Visual Studio settings mentioned, for ReSharper users, this is configured via:
ReSharper [menu] -> Options
In the Options dialog, navigate to Environment -> Editor -> Editor Behavior -> "Auto-format on closing brace". See image:
9 times out of 10 this problem is caused by bad code elsewhere on my document. Either I'm missing a ; on a line, or perhaps a closing }. Visual Studio is unable to figure out what I'm trying to write in code and thus it's unable to format. Check for compiler errors, fix them, and then press Ctrl+K then Ctrl + D to make Visual Studio reformat the current document (your hotkeys may vary, depending on the version of Visual Studio and your settings).

Resources