Curly braces sizes mismatch in Visual Studio 2022 - visual-studio

it happened after I installed Productivity Power Tools extension. It seemed not work with C++, so I deleted it. But after deletion, I noticed this "bug". I'm not even sure if it's extensions problem, but I really don't like it

This is probably down to the Shrink Empty Lines extension which is part of the Productivity Power Tools suite. You can configure it under Tools->Options...->Productivity Power Tools

Related

Enabling opening and closing tag guidelines in Visual Studio

I've recently started using Visual Studio quite heavily since starting to develop in .Net
I really like the intellisense as it increases my productivity by allowing me to code faster. Previously when authoring CSS I would just use Notepad ++ and I got very used to some of the little features that this awesome text editor possessed however, now that I am doing the bulk of my work in Visual Studio 2013 I want to try and avoid having too many environments open at once. With this in mind, there is one feature inparticular that I would like to try and replicate in Visual Studio when editing CSS or indeed any other type of code.
In Notepad ++ it automatically includes a sort of guideline which runs down the page between the opening and closing tags of elements as shown below:
My question is, how do I replicate this behaviour in Visual Studio 2013 as the currently setup I have at the moment isn't as clear/productive as you can see below:
Any help would be greatly appreciated.
There are a couple of free extensions you can use to do this. These will run on any of the Visual Studio versions except Express, which does not support extensions.
You can duplicate this with the Indent Guides extension.
You can also use the Structure Visualizer Feature of the Productivity Power Tools.
Note: The backgrounds in the example are different because they are taken on different machines with different themes.

Can I disable all compilation in Visual Studio?

This is a new one for me. I have been asked, for legal reasons, to setup a laptop with Visual Studio, but to disable the ability to compile projects/solutions. The purpose is to enable browsing of the source code, but not allow building or executing it.
Yes, I know this is really a stupid question and unfortunately I can't get into too many details. I've asked about using alternative text editors, but I have been told no. So until I can prove it isn't possible (or that I have at least made a reasonable effort), I have to try and make this work. Notepad++ would be an excellent alternative, but that has been rejected.
This would be in Visual Studio 2010 or later. Is there any way that I can do this?
UPDATE
After trying Marius Bancila's suggestion of removing the compilers and MSBuild, I was surprised to find out that VS continued to work fine (except for building, of course). I did not expect that functionality like F12 (Go To Definition) would continue to work.
This may mean that there still remains the ability to build something somewhere somehow. But as it stands with MSBuild permanently deleted and the Visual Studio Build command not working, it'll take some effort to get around it (if a way in fact does exist).
You didn't say what projects should not be possible to build (VC++, VC#, VB.NET, F#, etc.). Starting with VS2010 they are all built using MSBuild. So if you delete MSBuild they will not be able to build from inside Visual Studio. However, one can still be able to build from the command line, so the only possibility I see is that you delete all the compilers that come with Visual Studio.
It's a little bit crazy, but if you really have to ...
Try deleting some important binaries after installing Visual Studio e.g. linker (link.exe) and compiler (cl.exe).
Use a text editor instead. Notepad++ even comes with color syntax highlighting.
You cannot prevent people from compiling the code. Visual Studio Express is available to anyone, and the compiler can be executed from the command line, without Visual Studio's help.

Perform a search in Visual Studio only on files that have been recently modified

I was wondering if there is a way for Visual Studio's built-in search to only look in files that have been modified in a certain time frame.
I think it would be very convenient, especially when working with a large codebase where you don't really need to search for certain things in ancient code (or even code older than, say a month, even a week).
No. Not in Visual Studio 2010. Also not in Visual Studio 2012 (which includes the Quick Find feature from the Productivity Power Tools extension.)
You'll probably need to make do with Windows Search or a third party tool like Agent Ransack.

Disabling Team Foundation Server extensions in VS2010

We're using Visual Studio 2010 (Premium edition if it matters), and pretty happy with it. However, We're never going to use the TFS features that's included in the IDE. (We're using Jira and Subversion, as it's not just Visual Studio that we work with, but also IntelliJ and a couple other IDE's.)
Is there any way to disable the TFS portions of the IDE? It's not a big deal or anything, just for the sake of "keeping things neat."
In Visual Studio 2010, go to Tools->Options In the list, select Source Control. Set your Current source control plug-in: to None
The main "TFS" parts of the IDE are in Team Explorer - Just don't install it.
Anything else you don't want/use, I'd advise you to simply ignore - VS has support for hundreds or even thousands of different things that you will probably never use, and you can't easily "clean" them all away.
In my experience the more you alter your installation of Visual Studio the more problems you will have with it. Every custom Option you set is another thing you have to repeatedly set every time you get a new PC or install a new VS. (Although it has improved a lot since import/export options became available and reliable). I used to spend about half a day setting up a visual studio to "work well", and now I just install it and use it. Ultimately I found that it was easier to just adjust my working practices (e.g. by relearning a few keyboard shortcuts etc) than to try to bend VS to my will.

Matching a closing brace in Visual Studio

Is there a setting in Visual Studio 2008 that I can turn on which would generate a matching closing brace for a opening brace?
EDIT: I would imagine that an IDE as powerful as Visual Studio would have this very useful feature.
EDIT: Is there a macro that can be written? From the responses I have received it looks like ReSharper is the only option. I don't want to have to ask my company to invest in the ReSharper tool, I work for a rather large enterprise and getting anything approved from procurement is not an easy task.
EDIT: I am using VS 2010 Ultimate. The Power Tools and Power commands now do everything I was looking for in this post.
I know the original question is about VS2008, but I'm putting this here as info for other people and to make it useful for recent versions
VS 2010 and VS 2012
The Productivity Power Tools (available for VS2010 and VS2012) extension now supports automatic brace completion.
If you already have it installed for VS2010, you must update to at least version 10.0.10710.22. Click
Tools -> Extension Manager -> Updates
Once you have it installed, you can turn brace completion on or off by going to
Tools -> Options -> Productivity Power Tools -> All Extensions -> Automatic Brace Completion
The most recent version now provides the ability to turn of any features you don't like so you can configure it to your requirements
VS 2013
Even though there's a matching addin for Visual Studio 2013 as well, VS now has native support for automatic brace completion without using any addins. Just go to:
Tools -> Options -> Text Editor -> C#
Tick checkbox against Automatic brace completion
I use ReSharper. It does a whole lot more besides just the closing brace. The only downside is it's not free. But give it a try. The code analysis is worth the price anyway.
Most of the time, you can use autocompletion and code snippets.
If you want to write a for loop, just type "for" and then TAB. VS will complete it (including the braces).
Same thing for if, struct, class, switch... You don't even have to type the first brace !!
Good paper about it here : https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/programming-and-development/?p=655
EDIT: Thanks hyde, Steven's answer appears to be right: The Microsoft Productivity Power Tools do have a 2012 version now.
Original outdated answer:
It appears that the Microsoft Productivity Power Tools don't work in VS 2012 yet. If you're looking for a solution that works on the new version, you can check out this extension:
http://visualstudiogallery.msdn.microsoft.com/0e33cb22-d4ac-4f5a-902f-aff5177cc94d
In VS 2013 there is the option of "Automatic delimiter highlighting" (under tools, options, text editor) and while checking that box should highlight matching braces, it doesn't under default settings. This is because the default background is white, and the default highlight color is also white. This can be changed by going to environment, fonts and colors, and changing the background color of "brace matching (rectangle)". Then matching braces will be highlighted and visible.
I realized after I answered that the question was creating the brace not being able to find existing braces. As that's the question I was trying to answer when I ended up here I'm leaving the answer in case it's helpful.
Depends on what you are looking for VS does have some standard auto completion if[tab][tab] and for[tab][tab] try[tab][tab](and lots of other constructs) will get you more than the matching braces in a really nice fashion.
Late to the party here, but I guess you got use an independently running AutoHotKey script to insert closing brackets/quotes for you.
If you don't want to pay for ReSharper or a similar package, I made a free extension to automatically close braces. You can find it in the Visual Studio Gallery at http://visualstudiogallery.msdn.microsoft.com/en-us/0e33cb22-d4ac-4f5a-902f-aff5177cc94d. It will only work in Visual Studio 2010 though.

Resources