Visual Studio tuning

If you know other tools that make life easier, please do share.

Known to work with VS 2010:

Automatically convert tabs to spaces and remove trailing whitespaces

Source: http://stackoverflow…ual-studio-2008

Target: Tools->Macro->Macro Explorer then place it in e.g. MyMacros->EnvironmentEvents

#Region "Convert tab2space and kill trailing whitespaces"
	Private saved As Boolean = False
	Private Sub DocumentEvents_DocumentSaved(ByVal document As EnvDTE.Document) _
											 Handles DocumentEvents.DocumentSaved
		If Not saved Then
			Try
				' Convert tab to space
				DTE.Find.FindReplace(vsFindAction.vsFindActionReplaceAll, _
									 "\t", _
									 vsFindOptions.vsFindOptionsRegularExpression, _
									 "	", _
									 vsFindTarget.vsFindTargetCurrentDocument, , , _
									 vsFindResultsLocation.vsFindResultsNone)

				' Remove all the trailing whitespaces.
				DTE.Find.FindReplace(vsFindAction.vsFindActionReplaceAll, _
									 ":Zs+$", _
									 vsFindOptions.vsFindOptionsRegularExpression, _
									 String.Empty, _
									 vsFindTarget.vsFindTargetCurrentDocument, , , _
									 vsFindResultsLocation.vsFindResultsNone)

				saved = True
				document.Save()
			Catch ex As Exception
				MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Trim White Space exception")
			End Try
		Else
			saved = False
		End If
	End Sub
#End Region

Auto convert lineendings:

Source: http://grebulon.com/…are/stripem.php

Save process priorities:

This tool helps of saving adjusted process priorities right inside the task manager. This will allow setting the VS compiler (cl.exe) priority to “Below normal” or “Low” to preserve the responsiveness of the PC during multi-core compiles.

Source: http://www.ghacks.ne…ocess-priority/

Productivity Power Tools

Free extension for Visual Studio, that enhances the usability.

Source: http://visualstudiog…2-4adea1e34fef/

Visual Assist X (No freeware, academic license available)

Incredibly powerful extension for Visual Studio C++ development.

Source: http://wholetomato.c…cts/default.asp

[/CODE]

Thanks for this. Hope you don’t mind I moved it to a section visible for the public.

Totally deserve a +rep. Thank you very much <3

I’m using VS2010 and it has the possibility to automatically convert tabs into white spaces: Options → Text Editor → C/C++ → Tabs → Insert white spaces (use 4)

Same goes for notepad++, it has a flag that allows you to decide.

I still didn’t check for the trailing white spaces.

Using notepad++ to convert the above things in a whole directory gets easy with regexes:

convert tabs to spaces (without “”):

“\t” → " "

remove trailing white spaces (without “”):

“\s+$” → “”

All versions of VS have the setting to convert tabs to spaces…

http://www.dotnetperls.com/visual-studio-tab

This AddIn for Visual Studio does the same as the macro in first post, but instead of hardcoded amount of spaces, it takes them from

Options → Text Editor → [Language of saved file] → General → Tab size setting (and does not convert if VS is configured to keep tabs)

Microsoft dropped support for macros in VS 2012

This works with every version of VS (2005, 2008, 2010 and 2012)

Installing

Extracts contents of the archive to [Documents]Visual Studio [version]Addins

WhitespaceCleaner.zip

@Shauren Tested the AddIn on VS2013 but it won’t work - VS doesn’t recognizes the AddIn.

Seems like it’s because the WhitespaceCleaner.AddIn is missing:

Microsoft Visual Studio 12.0
  • some unknown needed changes - do you know what must be changed so VS2013 accepts the AddIn ?

Edit: Found the repo, thanks anyway. Ref - https://github.com/Shauren/wsclean-addin

WhitespaceCleaner_VS2013.zip