Pimp my Visual Studio

Use a Single Editor Well
The Pragmatic Programmer

I’ve had the pragmatic’s advice one my mind for many years, but never really attained power user status in Visual Studio. The problem I have is with keyboard short-cuts – I’m just not very good at remembering them. A friend, Mihir, said “if I do a short-cut 3 or 4 time I usually remember it”, for me it’s more like 30 or 40 times. Anyway back in September I decided to get ReSharper and learn Visual Studio a bit better. This has lead to a series of pimp’s to make Visual Studio 2008 work better for me.

ReSharper

ReSharper is a productivity tool for Visual Studio which provides enhanced navigation, refactoring and editing capabilities. Earlier in the year I was at a Software Craftsmanship conference, and asked a few of the C# guys there if they would spend their own money on ReSharper. Most of them said they would and had. They also said to use Intelli-J keyboard bindings, since they’re more common.

To help me remember, I’ve made a page summarizing Resharper and Visual Studio keyboard short-cuts. Some of the ReSharper features are so good, I use them all the time:

Ctrl+W Expand Selection From the current cursor position Ctrl+W will select the current word, repeating Ctrl+W increases the lexical scope of the selection. Simple but incredibly useful.
Ctrl+N Find Type Searches for Types in the solution. The really sweet thing is you can just type the capital letters of a camel humped name and it lists all the matches, which means if you can make a rough guess of what your looking for you can usually find it.
Ctrl+Shift+G Super Go Mini menu for GoTo Implementation, GoTo Declaration, GoTo Base, Find Usages, etc.
F2 Rename Rename Refactor
Crtl+Shift+R Refactor Brings up a list of available refactorings for the current cursor position.
Ctrl+Shift+Space Intellisense Only shows matching types.
Ctrl+Alt+Space Intellisense with using Searches all types in referenced assemblies, and will add a using if necessary.

The default setting for ReSharper are very good, and it’s makes smart naming suggestions. I’ve only made a few tweaks:

  • Ctrl+U – return to VS default of ToLower.
  • Added templates for MsTest and NUnit.
  • Tweaked to private members so as not to require an _. May well tweak to allow _ separated names in tests methods.
  • I’m unsure about all of it’s coding suggestions. For example I though the use var suggestion was stupid, but when I started to use it I really liked it. I may well switch make static off because it just doesn’t seem like a good idea.

There are a few downsides. It cost £140, which is quite a lot of cash. I was really excited about the unit test runner, but quite disappointed with the result. It runs MsTest slower than the native runner (which ain’t exactly quick either), even after bug fix in build 1288. The runner doesn’t seem to fit on the screen nicely either. The really cool feature it doesn’t have is automatic incremental test running.

Tab Rage

I am perplexed by the way tabs work in Visual Studio 2005 & 2008. I’m quite a visual thinker and so I remember where a tab is, rather than what it’s called. I find it incredibly frustrating when VS changes the order of the tabs, and hides the one I’m working on.

A quick search of the interweb shows I’m not the only one challenged by the tab feature. However the Visual Studio team have conducted “extensive usability studies” on their tabbing solution and concluded that it’s optimal for all users and they’re not going to change it, no way José. Clearly they didn’t have me in their usability study, because a chair through the one-way observation mirror followed by an enraged developer intent on GBH, may have suggested to them that this feature was not universally liked.

I recently discovered Tabs Studio, which replaces the Visual Studio tabs with sane behaviour. No longer does visual studio capriciously hide the tab I’m working on. I costs money, but £25 is a small price to pay to prevent an aneurysm. With sane tabs in place I also changed the Ctrl+Tab behaviour to be like a normal application.

Tabs Studio is not perfect. My main gripe is its lack visual polish. The icons and tabs should match the visual studio default much more closely. You can customise the look with XAML, and my tweak is shown below. The other thing is the vertical and horizontal tab group are not available as a right click option (they still work just not off right click). But hey, I’m no longer raging against the machine.

<Style TargetType="TabsStudio:CloseTabButton" BasedOn="{StaticResource DefaultCloseTabButtonStyle}">
    <Style.Triggers>
        <Trigger Property="IsTabSelected" Value="False">
            <Setter Property="Visibility" Value="Visible"/>
        </Trigger>
    </Style.Triggers>
</Style>

<Style TargetType="{x:Type TabsStudio:Tab}" BasedOn="{StaticResource DefaultTabStyle}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabsStudio:Tab}">
                <Grid>
                    <Border Name="Border" BorderBrush="DarkGray" BorderThickness="1,1,1,1"  CornerRadius="3,3,0,0" >
                        <ContentPresenter ContentSource="Header" Margin="2,1,2,1"/>
                    </Border>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsTabSelected" Value="True">
                        <Setter TargetName="Border" Property="Background" Value="White"/>
                    </Trigger>
                    <Trigger Property="IsTabSelected" Value="False">
                        <Setter TargetName="Border" Property="Background" Value="LightGray" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Paying money to get tabs to work is ridiculous. I think the Visual Studio team need to have a hug, and ask themselves how they got into this position.

Diff Tool

The Visual Studio diff tool is, I think, the one used in Visual Source Safe 6. I’ve replaced it with Source Gear’s DiffMerge, and followed these configuration instruction, to integrate it to Visual Studio. This is actually the oldest pimp that I have. I’ve used DiffMerge for over a year – I like it, and it’s free. Lots of the folks at work swear by WinMerge – I find the colour scheme garish.

Custom Menu

Part of Visual Studios feature army is a cohort of menu bars. I half feel like I should investigate the features and find the gems hidden within. But every time I look at them I find crap all that I care about, so I’ve just been switching them off; after all it’s quite nice to see the code window. I realised that the “standard” toolbar was almost pointless, so I made my own replacement toolbar which does exactly what I want:
mat-menu

I did a bit of customisation on the right click (context) menus. There’s a lot of rubbish on them which obscures the good, so I’ve cleansed them. I moved the excellent CollapseAll Resharper feature to the top of the menu.

Performance

At work we’ve all been having performance problems lately. It’s unclear what the problem is. It could be our Kapersky virus scanner or one of the barrage of security updates from Microsoft. I read that something called Windows 7 has just come out – coincidence? Our dev machines are pretty decent spec, Intel Core2 Quad Q9300 @ 2.5 GHz, with 4GB RAM running XP64. The weak point is probably the 7200 rpm hard drives. It could be that the alpha devs have moved up to solid state HDD‘s, and aren’t optimising for disk access anymore. Resharper has a torrid performance history and that’s another possible culprit, however my fellow monkeys are having similar problems and they’re not resharped.

To try and wring a bit more out of the machine I’ve tweaked a couple of registry settings, defragged the hard drive and re-installed Kapersky. I’ve also made some Visual Studio optimisations, via the Tools->Options menu:

  • Disable F1. (Environment->Keyboard)
  • Disable “Animate environment tools” (Environment->General).
  • Disable Start Page (Environment->Startup).
  • Disable “Track Active Item in Solution Explorer” (Projects and Solutions).
  • Disable Navigation Bar (Text Editor->C#).
  • Set “AutoToolboxPopulate” to false (Windows Forms Designer).

Windows

There are a few things I have to do to windows to make it work “right”:

I saw this really good explanation of Windows shortcuts. Pointing out the unity behind the scheme has helped me a lot.

6 thoughts on “Pimp my Visual Studio

  1. ?????????? ????????? ??????? ??/We offer a ready solution for SCHUECAL 2016 ALL MODULES (CRACK – Dongle emulator/Custom license/Patch). ?????? ????????? ????? ???????. ???????????? ????? ???????/Full support for our solutions. Testing before payment. ????????/Contacts: nodongle24 /@/ gmail.com (remove spaces and /)

    Guardant Time Net Dongle Emulator, Martix Dongle Emulator, Dinkey Dongle Emulator, Wibu Codemeter Dongle Emulator, Senselock Basic Dongle Emulator, Minilock Hid Dongle Emulator, Hasp Hl Dongle Emulator, Guardant Code Dongle Emulator, Net-SparKey Dongle Emulator, Matrixhid Dongle Emulator, Biteblock3 Dongle Emulator, FLEXID License Manager, Spark Keypro Dongle Emulator, Emme Inrokey Hid Dongle Emulator, Hasp H4 Dongle Emulator.

  2. Thank you for the auspicious writeup. It in fact was a
    amusement account it. Look advanced to more added agreeable from you!
    By the way, how could we communicate?

    my weblog … seo

  3. Are you looking for quality jerseys?
    We are jerseyshome,a company can offer you the best jerseys at the most favorable price,look forward your inquiry!
    Except the jerseys,we also offer many other items,for the detail ,please enter http://www.jerseyshome.cc/ !Have any other qustions,please feel free to contact me !Looking forward to your inquiry !

Comments are closed.