Problem with indentation when inserting snippet

R

Rotsey

Hi,

I am using VS2005 with C# and when go to insert a snippet
it is not indenting the code to where my current indent is.

Is this by design or is there a way to have it indent properly???

rotsey
 
P

Peter Duniho

I am using VS2005 with C# and when go to insert a snippet
it is not indenting the code to where my current indent is.

Is this by design or is there a way to have it indent properly???

I have found that usually (maybe always but I haven't figured out for
sure), when there's something that the compiler doesn't like
(extra/missing semicolon, undeclared "using" reference, pretty much
anything that would generate a compilation error), it doesn't mess with
the indentation.

I have also found that once I've fixed the issue, and for some reason
occasionally even if I don't, if I cut and repaste the code just within
the code editor window, VS will get the indentation right the second time
around.

Since I haven't tested that particular issue in a thorough manner, I can't
say for sure what's going on. But you might try doing the cut/paste thing
and see if that helps.

Pete
 
G

Guest

For what it is worth. I had the same problem.

Then it started working once I edited the XML snippet file in VS2005 and let
it do the indentation for me. In other words, inside the Code tag, I just
took the default VS2005 indentation and then when I dropped it in my source
code file, it correctly indented.

don't know why - it just did!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top