views:

90

answers:

1

I use Visual Assist X, build from 05.01.2009, but the same problem occurred in the previous releases as well. (I run it on MSVS 2005)

When I do some refactoring (like extracting a method), everything's fine, but all the curly braces move forward. For example, before refactoring the code looked like this:

while (expr)
{
  doSmth();
}

After refactoring:

while (expr)
  {
  doSmth();
  }

So, I need to move manually all the brackets. Sure, the problem is minor, but it becomes annoying when you do a lot of refactoring. Is it a bug or just default settings? So, does anyone know a workaround?

+2  A: 

It looks like Visual Assist takes its cue from the Visual Studio brace placement settings. To tweak this option, visit Tools|Options, then navigate to Text Editor, C/C++, Formatting. Make sure "Indent braces" is unticked.

(A related tip for general formatting issues after fiddling around with text is that you can get Visual Studio to do the reformatting for you. Put the cursor on one of the mispositioned braces, press Ctrl+Shift+] (extend selection to matching brace), then press Ctrl+K, Ctrl+F (reformat selection).)

BTW for genuine Visual Assist bugs the forum is a good place to go:

http://www.wholetomato.com/forum/

They seem to be only a small company, but they're generally pretty good at keeping track of open issues.

brone
Ctrl+K, Ctrl+F reformats selection according to the current coding style scheme. It seems that my current scheme implies excessive spaces before braces (like in the example). Do you know the way how to customize that scheme?
overrider
Ahh... right, I see your problem now (I think!). Visit Tools|Options, then navigate to Text Editor, C/C++, Formatting. Make sure "Indent braces" is unticked. That might do it...
brone
Yeah, that works! Please copy it to the answer, and I'll accept it.
overrider
Glad it worked... response edited, hopefully into something useful!
brone